Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Animated geometry in layout flickering
Forum Updated to NodeBB v4.3 + New Features

Animated geometry in layout flickering

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 937 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.
  • R Offline
    R Offline
    Rostislav
    wrote on last edited by
    #1

    Hi Qt community,

    I seem to have a problem of making a flicker free geometry animation when my widget is embedded into a layout.
    The basic idea is that I want multiple checkable buttons in toolbar which when clicked discover some other buttons hidden under them.

    To achieve that I do the following:

    Create horizontal layout
    Add the main button
    Add a "PopupWidget"
    Repeat

    The PopupWidget itself is a class inspired by ctkPopupWidget
    My implementation subclasses QStackedWidget with 2 widgets

    1. A QWidget with zero-margin vertical layout, which contains a QFrame where all the child buttons would be put into
    2. A QWidget with zero-margin vertical layout, which contains a QLabel

    When it is requested to close, a pixmap is created for QLabel using QWidget::grab() on first page in the PopupWidget. Then, the page of QStackedWidget is changed to show the QLabel. Finally an animation is set up to reduce geometry from the starting geometry to the one with zero width. Geometry is not animated directly, but rather I have a property in PopupWidget which is animated and the write function for this property uses setFixedSize() so that the layout is updated.

    However, when the animation is run, the checkable button flickers. I watched at screen grab frame by frame and the button seems to move by a couple of pixels or its size is changed (even though I set its policy to Fixed).
    This flickering doesn't happen every time, but it is very annoying.

    Any ideas about this?

    Rostislav.

    PS:
    short video showing the problem: https://www.dropbox.com/s/9u0xywpik1bw1ww/Popup_Widget.mp4?dl=0
    the zipped source code: https://www.dropbox.com/s/flibxta4v3io8fl/PopupWidget.zip?dl=0

    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