Results 1 to 9 of 9

Thread: Avoiding flickering when dynamically changing content of a widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    109
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    9
    Thanked 12 Times in 10 Posts

    Default Re: Avoiding flickering when dynamically changing content of a widget

    Well, the dialog contains several overlayed groupboxes which can be alternatively shown and enabled (unfortunately the stack widget won't do the job because it may be necessary to see several groupboxes at the same time). And the number of total widgets and layouts can be around 50 or more.

    But even with a small number of widgets, the problem persists. One solution was so far to hide the parent widget of the layout where the change occurred. However, in some case the flicker is still there.

    I checked the layout implementation and it seems that when I turn a widget on, the parent layout will get invalidated and posting a RequestLayout event, so does the parent widget and all the layouts above which can result in quite a few layout events to be processed by the layoutengine.

    Now, the suggestion with turning of the event signals sounds like a solution. Essentially, what I would want is just one layout-update of the whole dialog and all its widgets.

    So, how would I do that? How and where should I disconnect the RequestLayout event?

    Andreas
    Andreas

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Avoiding flickering when dynamically changing content of a widget

    I think you can forget about my solution because QLayout does not have any (public) signals .

    Maybe if you can post a small example reproducing the problem, I will take a look at it later on.

  3. #3
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    109
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    9
    Thanked 12 Times in 10 Posts

    Default Re: Avoiding flickering when dynamically changing content of a widget

    Marcel (and others who want to see the effect), I attached a short example that illustrates the problem.

    Compile, run and then press the buttons 1 and 5 (toggle visibility of a group box) and check/uncheck the advanced box.

    You will see in either case a flickering when the layout is redone.

    Mind that this is a fairly "lightweight" example of a dialog with about 50 widgets, others have about 150 to 300 widgets. For these cases the layout updating should really be done in the background before the whole thing gets drawn again.

    Thanks for any suggestions!
    Andreas
    Attached Files Attached Files
    Andreas

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Avoiding flickering when dynamically changing content of a widget

    I'd put a stacked widget inside groupBoxCircleSegmentOptions and just switch the page when corresponding toolButton_N is clicked. This way Ok, Cancel and Abort buttons would always stay at same place instead of jumping back and forth.

    Btw, check this article: Flicker Be Gone
    J-P Nurmi

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.