PaintEvent performance
-
Hello, I am using Qt on pcDuino2 development board.
I need to do a fade in/out animation on an image displayed on a full HD display. I draw directly onto a fullscreen QWidget. What I do is that I update an alpha value in a thread and call update() through a signal to repaint the fullscreen widget. I first paint the pixmap then I fill a black rectangle with the new alpha value.
I try to repaint 30 FPS and the animation is very smooth on my laptop, but on pcDuino it is terrible (like 3 FPS or something). The paintEvent code is below, it is written using PySide but you can give advice using C++ as well.
I tried using QGraphicsScene but it didn't help either. So what advice would you give to make this a smooth animation with max performance?
@def paintEvent(self, event):
qp = QtGui.QPainter()
qp.begin(self)qp.drawPixmap(0, 0, self.my_pixmap) qp.fillRect(0, 0, self.size().width(), self.size().height(), QtGui.QColor(0, 0, 0, round(self.fade_alpha))) qp.end()@