Results 1 to 5 of 5

Thread: Flickering on resizing a frameless widget

  1. #1
    Join Date
    May 2009
    Posts
    52
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4

    Default Flickering on resizing a frameless widget

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Flickering on resizing a frameless widget

    Show us your code please.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2009
    Posts
    52
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4

    Default Re: Flickering on resizing a frameless widget

    I've attached a working example as a VC 2008 project
    Attached Files Attached Files

  4. #4
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 106 Times in 103 Posts

    Default Re: Flickering on resizing a frameless widget

    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).

  5. #5
    Join Date
    May 2009
    Posts
    52
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4

    Default Re: Flickering on resizing a frameless widget

    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

Similar Threads

  1. How to make frameless widget as a window or dialog
    By ainne810329 in forum Qt Programming
    Replies: 6
    Last Post: 4th November 2011, 10:27
  2. Replies: 10
    Last Post: 25th October 2010, 23:59
  3. Widget is not so smooth when resizing?
    By MorrisLiang in forum Newbie
    Replies: 2
    Last Post: 11th May 2010, 01:44
  4. Replies: 8
    Last Post: 20th September 2007, 09:10
  5. Widget resizing problem
    By fwohlfert in forum Qt Programming
    Replies: 3
    Last Post: 23rd February 2006, 08:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.