[Development] Under Windows QWindow receiving QExposeEvent on window drag.

Agocs Laszlo laszlo.agocs at theqtcompany.com
Mon Jan 19 13:34:49 CET 2015


Because some unfortunate code in the Windows platform plugin generates expose events even when the size has not changed. This is of course wrong. It will be corrected by https://codereview.qt-project.org/#/c/103932


Cheers,

Laszlo


________________________________
From: development-bounces+laszlo.agocs=theqtcompany.com at qt-project.org <development-bounces+laszlo.agocs=theqtcompany.com at qt-project.org> on behalf of Trent Reed <treed0803 at gmail.com>
Sent: Sunday, January 18, 2015 6:04 AM
To: development at qt-project.org
Subject: [Development] Under Windows QWindow receiving QExposeEvent on window drag.

I am attempting to animate a QOpenGLWindow, so I'm connecting SIGNAL(frameSwapped()) with SLOT(update()) to force update on vsync as recommended in the documentation. So far so good, under *nix OSes this works fine. (Tested on x64 Ubuntu and OS X)

But on Windows, when dragging a window around, the QExposeEvent gets sent out while dragging the window, causing the window to lag noticeably. (This does NOT happen on *nix OSes!)

I am able to "hack" a fix by caching the previous QRegion in my derived QOpenGLWindow class, and checking to see if the new exposeEvent->region() is the same as the cached QRegion. If the cached region is the same, I ignore the event. If they are different, I pass it down to QOpenGLWindow. This appears to fix the problem.

Here is my change that fixes the problem under my own project: https://github.com/TReed0803/QtOpenGL/commit/f243e879b1d639fd838deffd6b2ca095062addc1

I feel I shouldn't have to do this, it seems kind of hacky. Is this a bug?

Thanks,
- Trent Reed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150119/f09a4f65/attachment.html>


More information about the Development mailing list