PDA

View Full Version : Flickering on resizing a frameless widget



Carlsberg
11th March 2012, 07:48
I want to make a custom window from a frameless widget. Basically it's a QFrame on which I've set a border with QSS. I've implemented a resize mechanism using the mouse events, basically I calculate the new geometry and set it in mouseMoveEvent(). The problem is that I get a flicker on the right / bottom side of the window, especially when I try to make the window smaller. I suppose that's because I send repaint events too fast through setGeometry(). Any ideas on how I could solve this?

wysota
11th March 2012, 11:51
Show us your code please.

Carlsberg
11th March 2012, 17:07
I've attached a working example as a VC 2008 project

Spitfire
13th March 2012, 09:58
I've came across this issue some time ago and I couldn't find any solution.

From what I've learned it happens because your window is frameless and border belongs to client area which gets clipped/stretched when size changes before the widget has chance to repaint it.

If you'd do the same styling for actual window border it would be ok but when you add more content to the widget the problem will be visible again.

Take any Windows window (ie open some directory in explorer), grab left edget of the window and quickly move it left and right.
Notice that the frame updates are correct (as it's not client area and is managed by os) but the content are not (well visible in top right corner of the window).

Carlsberg
14th March 2012, 09:53
Yes, you are right. What I have done to ameliorate the effect was to put the geometry updates on a timer, 30 per second. Now it's a little jumpier when I drag it fast, but the effect is much more tolerable