Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. QPropertyAnimation funktioniert nicht
QtWS25 Last Chance

QPropertyAnimation funktioniert nicht

Scheduled Pinned Locked Moved Solved German
8 Posts 3 Posters 799 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.
  • S Offline
    S Offline
    sp3x
    wrote on last edited by
    #1

    Hallo,

    folgenden Cod ehab eich und bekomme die nachfolgende Fehlermeldung:

    /**
     * @brief MainMenuWidget::btnMenuClicked
     */
    void MainMenuWidget::btnMenuClicked()
    {
        qDebug() << this;
        QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
        animation.setDuration(500);
    
        if(isMaximized()) {
            setProperty("defaultWidth", width());
            //setMaximumWidth(m_config["minimizedWidth"].toInt());
            animation.setStartValue(width());
            animation.setEndValue(m_config["minimizedWidth"].toInt());
        } else {
            //setMaximumWidth(property("defaultWidth").toInt());
            animation.setStartValue(width());
            animation.setEndValue(property("defaultWidth").toInt());
        }
    
        animation.start(QAbstractAnimation::DeleteWhenStopped);
    }
    

    Die Konsolenausgabe dazu ist:

    MainMenuWidget(0x26eb99ac210, name="menuContainer")
    QPropertyAnimation::updateState (): Changing state of an animation without target
    

    Ich verstehe es nicht. Das Object in "this" hat geerbt von QWidget.

    Ich wäre dankbar für eure Hilfe.

    JoeCFDJ S 2 Replies Last reply
    0
    • S sp3x

      Hallo,

      folgenden Cod ehab eich und bekomme die nachfolgende Fehlermeldung:

      /**
       * @brief MainMenuWidget::btnMenuClicked
       */
      void MainMenuWidget::btnMenuClicked()
      {
          qDebug() << this;
          QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
          animation.setDuration(500);
      
          if(isMaximized()) {
              setProperty("defaultWidth", width());
              //setMaximumWidth(m_config["minimizedWidth"].toInt());
              animation.setStartValue(width());
              animation.setEndValue(m_config["minimizedWidth"].toInt());
          } else {
              //setMaximumWidth(property("defaultWidth").toInt());
              animation.setStartValue(width());
              animation.setEndValue(property("defaultWidth").toInt());
          }
      
          animation.start(QAbstractAnimation::DeleteWhenStopped);
      }
      

      Die Konsolenausgabe dazu ist:

      MainMenuWidget(0x26eb99ac210, name="menuContainer")
      QPropertyAnimation::updateState (): Changing state of an animation without target
      

      Ich verstehe es nicht. Das Object in "this" hat geerbt von QWidget.

      Ich wäre dankbar für eure Hilfe.

      S Offline
      S Offline
      sp3x
      wrote on last edited by
      #4

      @sp3x said in QPropertyAnimation funktioniert nicht:

      QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");

      Ohmann, das Problem liegt hier:

      QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
      

      Das Sternchen bei der declaration als Pointer hat gefehlt.

      So is richtig:

      QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");
      
      JoeCFDJ 1 Reply Last reply
      1
      • S sp3x

        Hallo,

        folgenden Cod ehab eich und bekomme die nachfolgende Fehlermeldung:

        /**
         * @brief MainMenuWidget::btnMenuClicked
         */
        void MainMenuWidget::btnMenuClicked()
        {
            qDebug() << this;
            QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
            animation.setDuration(500);
        
            if(isMaximized()) {
                setProperty("defaultWidth", width());
                //setMaximumWidth(m_config["minimizedWidth"].toInt());
                animation.setStartValue(width());
                animation.setEndValue(m_config["minimizedWidth"].toInt());
            } else {
                //setMaximumWidth(property("defaultWidth").toInt());
                animation.setStartValue(width());
                animation.setEndValue(property("defaultWidth").toInt());
            }
        
            animation.start(QAbstractAnimation::DeleteWhenStopped);
        }
        

        Die Konsolenausgabe dazu ist:

        MainMenuWidget(0x26eb99ac210, name="menuContainer")
        QPropertyAnimation::updateState (): Changing state of an animation without target
        

        Ich verstehe es nicht. Das Object in "this" hat geerbt von QWidget.

        Ich wäre dankbar für eure Hilfe.

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #2

        animation->setPropertyName() ist vermissed.

        S 1 Reply Last reply
        0
        • JoeCFDJ JoeCFD

          animation->setPropertyName() ist vermissed.

          S Offline
          S Offline
          sp3x
          wrote on last edited by
          #3

          @JoeCFD Hi, ich denke nicht, dass das das Problem ist. Beim Erzeugen übergebe ich ja "maximumWidth". Aber ich werde es nachher mal testen.

          1 Reply Last reply
          0
          • S sp3x

            Hallo,

            folgenden Cod ehab eich und bekomme die nachfolgende Fehlermeldung:

            /**
             * @brief MainMenuWidget::btnMenuClicked
             */
            void MainMenuWidget::btnMenuClicked()
            {
                qDebug() << this;
                QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
                animation.setDuration(500);
            
                if(isMaximized()) {
                    setProperty("defaultWidth", width());
                    //setMaximumWidth(m_config["minimizedWidth"].toInt());
                    animation.setStartValue(width());
                    animation.setEndValue(m_config["minimizedWidth"].toInt());
                } else {
                    //setMaximumWidth(property("defaultWidth").toInt());
                    animation.setStartValue(width());
                    animation.setEndValue(property("defaultWidth").toInt());
                }
            
                animation.start(QAbstractAnimation::DeleteWhenStopped);
            }
            

            Die Konsolenausgabe dazu ist:

            MainMenuWidget(0x26eb99ac210, name="menuContainer")
            QPropertyAnimation::updateState (): Changing state of an animation without target
            

            Ich verstehe es nicht. Das Object in "this" hat geerbt von QWidget.

            Ich wäre dankbar für eure Hilfe.

            S Offline
            S Offline
            sp3x
            wrote on last edited by
            #4

            @sp3x said in QPropertyAnimation funktioniert nicht:

            QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");

            Ohmann, das Problem liegt hier:

            QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
            

            Das Sternchen bei der declaration als Pointer hat gefehlt.

            So is richtig:

            QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");
            
            JoeCFDJ 1 Reply Last reply
            1
            • S sp3x has marked this topic as solved on
            • S sp3x

              @sp3x said in QPropertyAnimation funktioniert nicht:

              QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");

              Ohmann, das Problem liegt hier:

              QPropertyAnimation animation = new QPropertyAnimation(this, "maximumWidth");
              

              Das Sternchen bei der declaration als Pointer hat gefehlt.

              So is richtig:

              QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");
              
              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by
              #5

              @sp3x said in QPropertyAnimation funktioniert nicht:

              QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");

              Ich habe es auch nicht gesehen. Wie konntest Du Dein Code kompilieren? Gab es keine Fehlermeldung?

              Mit auto kannst Du das gleiche Problem vermeiden.
              auto animation = new QPropertyAnimation(this, "maximumWidth");

              Pl45m4P S 2 Replies Last reply
              0
              • JoeCFDJ JoeCFD

                @sp3x said in QPropertyAnimation funktioniert nicht:

                QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");

                Ich habe es auch nicht gesehen. Wie konntest Du Dein Code kompilieren? Gab es keine Fehlermeldung?

                Mit auto kannst Du das gleiche Problem vermeiden.
                auto animation = new QPropertyAnimation(this, "maximumWidth");

                Pl45m4P Offline
                Pl45m4P Offline
                Pl45m4
                wrote on last edited by
                #6

                @JoeCFD said in QPropertyAnimation funktioniert nicht:

                Mit auto kannst Du das gleiche Problem vermeiden.

                Ist das nicht eine schlechte Angewohnheit auto zu oft zu nutzen?

                (Isn't this a bad habit/style to use auto too often? In theory, you could replace almost every variable with auto, but then your code would be a mess or at least harder to understand)


                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                JoeCFDJ 1 Reply Last reply
                0
                • Pl45m4P Pl45m4

                  @JoeCFD said in QPropertyAnimation funktioniert nicht:

                  Mit auto kannst Du das gleiche Problem vermeiden.

                  Ist das nicht eine schlechte Angewohnheit auto zu oft zu nutzen?

                  (Isn't this a bad habit/style to use auto too often? In theory, you could replace almost every variable with auto, but then your code would be a mess or at least harder to understand)

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by JoeCFD
                  #7

                  @Pl45m4 new QPropertyAnimation sagt alles. Kein Problem hier. Ansonst hast Du recht.

                  1 Reply Last reply
                  1
                  • JoeCFDJ JoeCFD

                    @sp3x said in QPropertyAnimation funktioniert nicht:

                    QPropertyAnimation* animation = new QPropertyAnimation(this, "maximumWidth");

                    Ich habe es auch nicht gesehen. Wie konntest Du Dein Code kompilieren? Gab es keine Fehlermeldung?

                    Mit auto kannst Du das gleiche Problem vermeiden.
                    auto animation = new QPropertyAnimation(this, "maximumWidth");

                    S Offline
                    S Offline
                    sp3x
                    wrote on last edited by sp3x
                    #8

                    @JoeCFD genau die Frage habe ich mir auch gestellt! Kann ich nicht beantworten. Hat so ohne Fehler oder Warnung funktioniert. Eigentlich nicht möglich. Vielleicht hab ich noch nen Bock drinne gehabt.

                    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