Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Make sure window is animated on show()

    General and Desktop
    3
    5
    3314
    Loading More Posts
    • 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.
    • K
      Kwabena last edited by

      Is it possible to ensure a window is animated when shown?

      So, basically when you create a new dialog it gets shown popping up in a little animation. Then if you kill it or show it again it just appears or disappears. Is there a way to make it animated on hide and show? In particular, for showing.

      1 Reply Last reply Reply Quote 0
      • C
        Code_ReaQtor last edited by

        Try "QPropertyAnimation":http://qt-project.org/doc/qt-4.8/qpropertyanimation.html

        Please visit my open-source projects at https://github.com/Code-ReaQtor.

        1 Reply Last reply Reply Quote 0
        • K
          Kwabena last edited by

          How do I use that for showing? Also, I think the window manger does something different for MS Windows. Maybe I need to delete cached information about the window or something. I noticed that when the window is shown the first time it animates.

          1 Reply Last reply Reply Quote 0
          • C
            Code_ReaQtor last edited by

            Not sure if this "link":http://stackoverflow.com/questions/3283587/qwidget-resize-animation will directly solve your problem, but try reading it. It will give you insights on how to implement it.

            Please visit my open-source projects at https://github.com/Code-ReaQtor.

            1 Reply Last reply Reply Quote 0
            • raven-worx
              raven-worx Moderators last edited by

              do something like this in your dialog window class:
              @
              void MyDialog::showEvent(QShowEvent* event)
              {
              QDialog::showEvent(event);

               QPropertyAnimation* anim = new QPropertyAnimation(this, "windowOpacity");
                    anim->setStartValue(0.0);
                    anim->setEndValue(1.0);
                    anim->setDuration(1000);
               anim->start(QAbstractAnimation::DeleteWhenStopped);
              

              }
              @

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply Reply Quote 1
              • First post
                Last post