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. QPropertyAnimation for widgets in layout

QPropertyAnimation for widgets in layout

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 2.5k 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.
  • M Offline
    M Offline
    Marek
    wrote on last edited by
    #1

    Hi all,

    I have problem with animating widgets height in QVBoxLayout.
    Widgets are QFrame's stacked one above another arranged with QVBoxLayout inside QScrollAreaWidget
    When I start QPropertyAnimation for geometry of the first widget it changes it height but other items in layout don't change their position. In other words first expanded widget is obsured by the next QFrame and what is more when I resize main window all widgets rearrange their heights as the animation never took place

    Is it possible to animate widget height in layout ? so the other items follow the animation?

    When I was doing the same in QGraphicsView (changing height of QGraphicsRectItem) next item was child of the first and always positioned e.g 20px below first item, so when I changed the first item height other items moved automatically. Is it possible with widgets ?

    Best Regards
    Marek

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      The layout will try to arrange them so
      animating the geometry at the same time
      might not produce the effect you are after.

      Animating maximum Height might work better as layout try to respect that.

      1 Reply Last reply
      2
      • M Offline
        M Offline
        Marek
        wrote on last edited by
        #3

        Hi,

        Thanks for the tip,
        I'm using now valueChanged SIGNAL from QPropertyAnimation for setMinimumSize for widget and it works as You said.
        I also need some widgets to be visible after QFrame height is increased so I'm doing some tests.
        Basically I want to be sure which way should I go, classic QWidgets or QGraphicsItems where I have the full control.
        Will post my findings.

        1 Reply Last reply
        1
        • M Offline
          M Offline
          Marek
          wrote on last edited by
          #4

          Hi,

          It works with QLayout and animated widgets. (Qt 5.7)

          setSizeConstraint(QLayout::SetFixedSize) for the layout is crucial, otherwise items move slightly when animation is running.

          Best Regards
          Marek

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved