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. Animation with QPropertyAnimation and QTimer
Qt 6.11 is out! See what's new in the release blog

Animation with QPropertyAnimation and QTimer

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 3 Posters 6.8k 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.
  • 21sdino2 21sdino

    I want that when the timer ends the icon appears to be illuminated
    but this does not work
    connect (timer, SIGNAL (timeout ()), UI- <label1, SLOT (setPIxmap (pix));

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #10

    @21sdino
    nope
    that is not valid syntax :)
    connect (timer, SIGNAL (timeout ()), UI- <label1, SLOT (setPIxmap (pix));
    You cannot just call a function like that with a random parameter. You must use a slot function that
    has same parameters as the signal. here signal is timeout () and it has no parameters.

    So Its not how it works. Did u study ?
    http://doc.qt.io/qt-5/signalsandslots.html

    you could hook up
    http://doc.qt.io/qt-5/qabstractanimation.html#finished

    and then call
    setPIxmap (pix) in that slot

    1 Reply Last reply
    2
    • 21sdino2 Offline
      21sdino2 Offline
      21sdino
      wrote on last edited by
      #11

      so? connect(anim1,SIGNAL(finished()),ui->label1,SLOT(setPixmap(pix)));

      mrjjM 1 Reply Last reply
      0
      • 21sdino2 21sdino

        so? connect(anim1,SIGNAL(finished()),ui->label1,SLOT(setPixmap(pix)));

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #12

        @21sdino
        so that is still wrong u cannot just use a random function as slot. u must make your own :)
        mainwinow.h
        slots:
        void AnimFinished();

        .cpp
        void mainwindow::AnimFinished() {
        setPIxmap (pix); /// here its legal
        }

        connect(anim1,SIGNAL(finished()),ui->label1,SLOT(AnimFinished()));

        1 Reply Last reply
        0
        • 21sdino2 Offline
          21sdino2 Offline
          21sdino
          wrote on last edited by
          #13

          the problem remains the same I do not understand why

          mrjjM 1 Reply Last reply
          0
          • 21sdino2 21sdino

            the problem remains the same I do not understand why

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #14

            @21sdino
            but when animation is finished, your slot is called
            and u can then set the pixmap you want?

            Im not sure which part is not working.

            1 Reply Last reply
            0
            • 21sdino2 Offline
              21sdino2 Offline
              21sdino
              wrote on last edited by
              #15

              only it works in more cases than before but not in all

              mrjjM 1 Reply Last reply
              0
              • 21sdino2 21sdino

                only it works in more cases than before but not in all

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #16

                @21sdino
                Ok, i cant tell. seems ok.
                You should single step and see what is going on.

                1 Reply Last reply
                0
                • 21sdino2 Offline
                  21sdino2 Offline
                  21sdino
                  wrote on last edited by
                  #17

                  i'm tring this from 2 days and i'don't find the solution

                  mrjjM 1 Reply Last reply
                  0
                  • 21sdino2 21sdino

                    i'm tring this from 2 days and i'don't find the solution

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #18

                    @21sdino
                    ok, but u need to use more QDebug and find out where it fails.
                    Sadly we cannot just guess it. Or at Least I cannot.

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      euchkatzl
                      wrote on last edited by
                      #19

                      Could you please explain in detail what you want to do ?
                      Your code does not seem to be very structured.
                      As @mrjj says we can only guess what you are doing.

                      I think you have to remove your QGraphicsOpacityEffect after animation ends (ui->label2->setGraphicsEffect(NULL);) because your end value is 0.3 and this means it has no full opacity.

                      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