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
QtWS25 Last Chance

QPropertyAnimation doing nothing

Scheduled Pinned Locked Moved Solved Mobile and Embedded
qpropertyanimat
11 Posts 2 Posters 3.4k Views
  • 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.
  • McLionM Offline
    McLionM Offline
    McLion
    wrote on last edited by McLion
    #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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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

      McLionM 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

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

        McLionM Offline
        McLionM Offline
        McLion
        wrote on 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
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on 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
          • McLionM Offline
            McLionM Offline
            McLion
            wrote on 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
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 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
              • McLionM Offline
                McLionM Offline
                McLion
                wrote on 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
                • McLionM Offline
                  McLionM Offline
                  McLion
                  wrote on last edited by
                  #8

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

                  Thanks anyway!

                  1 Reply Last reply
                  0
                  • McLionM Offline
                    McLionM Offline
                    McLion
                    wrote on 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
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 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
                      • McLionM Offline
                        McLionM Offline
                        McLion
                        wrote on 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

                        • Login

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