Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QPropertyAnimation doing nothing
Forum Updated to NodeBB v4.3 + New Features

QPropertyAnimation doing nothing

Scheduled Pinned Locked Moved Solved Mobile and Embedded
qpropertyanimat
11 Posts 2 Posters 3.5k Views 2 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
    McLion
    wrote on 2 Dec 2015, 16:11 last edited by McLion 12 Feb 2015, 16:17
    #1

    HI

    I try to animate the appearance of a Widget, to be more precise a QWebView on eLinux, Qt4.6.3.
    I replaced this line:

    ui->webGUI->setGeometry(x, y, w, h);
    

    with this:

    QPropertyAnimation animation(ui->webGUI, "geometry");
    animation.setDuration(10000);
    animation.setStartValue(QRect(0, 0, 0, 0));
    animation.setEndValue(QRect(x, y, w, h));
    animation.start();
    

    Shouldn't this animate the QWebView like "opening" from 0 to its final coordinates?
    Nothing is animated. The Widget still opens directly at its End Value (pos,size).

    What am I doing wrong?
    Thanks for any suggestion.
    McL

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Dec 2015, 23:11 last edited by
      #2

      Hi,

      You're allocating it on the stack, so as soon as your function is done, animation is destroyed.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 3 Dec 2015, 07:52
      0
      • S SGaist
        2 Dec 2015, 23:11

        Hi,

        You're allocating it on the stack, so as soon as your function is done, animation is destroyed.

        M Offline
        M Offline
        McLion
        wrote on 3 Dec 2015, 07:52 last edited by
        #3

        @SGaist
        I realized that later and I was just about to update this thread.
        I now have in the constructor of the main window and in the header, class private section:

        QPropertyAnimation *animation;
        

        And changed the rest to:

        animation = new QPropertyAnimation(ui->webGUI, "geometry");
        animation->setDuration(10000);
        animation->setStartValue(QRect(0, 0, 100, 30));
        animation->setEndValue(QRect(x, y, w, h));
        animation->start();
        

        Still no joy!
        There's still something wrong.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 3 Dec 2015, 08:19 last edited by
          #4

          You should rather start that animation once everything is constructed using e.g. a single shot QTimer with value 0. Right now you are starting your animation while the event loop hasn't even started.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            McLion
            wrote on 3 Dec 2015, 08:33 last edited by
            #5

            I'm not sure I understand you correctly. This part of the code

            animation = new QPropertyAnimation(ui->webGUI, "geometry");
            animation->setDuration(10000);
            animation->setStartValue(QRect(0, 0, 100, 30));
            animation->setEndValue(QRect(x, y, w, h));
            animation->start();
            

            is in an function that is called normally at runtime when everything is up and running.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 3 Dec 2015, 12:05 last edited by
              #6

              Is webGui in a layout ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • M Offline
                M Offline
                McLion
                wrote on 3 Dec 2015, 12:13 last edited by
                #7

                No. I have the following structure:
                -- QTGUI_MainWindow (class QMainWindwo)
                --- centralWidget (class QWidget)
                ---- webGUI (class QWebView)
                ---- ...... all other elements

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  McLion
                  wrote on 3 Dec 2015, 15:22 last edited by
                  #8

                  Got it working.
                  Silly (and embarrassing) bug in correct calling ...

                  Thanks anyway!

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    McLion
                    wrote on 3 Dec 2015, 15:45 last edited by
                    #9

                    I'd like to open this again.
                    Is this known to be extremely power consuming?
                    Animating a Textbox or an empty WebView works acceptable.
                    If it's loaded with some html content it's extremely choppy, not to say unusable.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 3 Dec 2015, 21:41 last edited by
                      #10

                      It depends on what you are currently animating. If it something that needs processing before painting then you might get a performance hit.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        McLion
                        wrote on 4 Dec 2015, 09:05 last edited by
                        #11

                        OK. I changed the code to make sure there is nothing else consuming CPU power while moving. Still, specially when moving fast, edges are jagged while moving and sometimes it even jumps.

                        Could be the limit of the ARM CPU or the directFB graphic acceleration.
                        It would be better if supplying new coordinates to the FB would be synced to the frame rate, but I don't think that I can change something on that level.

                        Too bad ..

                        1 Reply Last reply
                        0

                        4/11

                        3 Dec 2015, 08:19

                        7 unread
                        • Login

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