Translate code interpretation of pyqt5?

def paintEvent(self, paintEvent):
    painter = QPainter(self)
    painter.translate(self.width()/2, self.height()/2)
    painter.rotate(45) 
    painter.translate(-self.width()/2, -self.height()/2) -sharp 

as shown in the figure and code, according to my understanding,

  1. translate width/2
  2. rotate 45
  3. Pan-width/2

the result should be green, but it is actually red

how should I explain it?

Dec.20,2021

No pyqt, seems to be a problem with the center of rotation.
Press upper left corner to rotate to get green .
Press the midpoint of the rectangle to rotate to get red .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf421b-31edc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf421b-31edc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?