Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. PaintEvent performance
Forum Updated to NodeBB v4.3 + New Features

PaintEvent performance

Scheduled Pinned Locked Moved Mobile and Embedded
1 Posts 1 Posters 693 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    canol
    wrote on last edited by
    #1

    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()@
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved