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. Make sure window is animated on show()

Make sure window is animated on show()

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.1k 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.
  • K Offline
    K Offline
    Kwabena
    wrote on last edited by
    #1

    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
    0
    • C Offline
      C Offline
      Code_ReaQtor
      wrote on last edited by
      #2

      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
      0
      • K Offline
        K Offline
        Kwabena
        wrote on last edited by
        #3

        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
        0
        • C Offline
          C Offline
          Code_ReaQtor
          wrote on last edited by
          #4

          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
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            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
            1

            • Login

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