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. Animate widget geometry inside layout
Qt 6.11 is out! See what's new in the release blog

Animate widget geometry inside layout

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

    Hello,
    I have a problem with animating widget which is placed inside layout. The struct is like fallowing:
    @
    mainWidget with HBoxLayout
    {
    animatedWidget
    otherWidget
    verticalSpacer
    }
    @

    When I decrease the animatedWidget height, the layout does not refresh - otherWidget's top position is always the same, no matter which sizePlicy of animatedWidget do I choose. What is more, when I resize the window, the animatedWidget's height increases to the start value.

    I want to get effect of collapsing widget. Animation code:
    @
    ui->animatedWidget->setMinimumHeight(0);
    ui->animatedWidget->layout()->setEnabled(false);
    QPropertyAnimation *anim = new QPropertyAnimation(ui->animatedWidget, "geometry", 0);
    QRect a = ui->animatedWidget->geometry();
    a.setHeight(0);
    anim->setEndValue(a);
    anim->start(QPropertyAnimation::DeleteWhenStopped);
    @

    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