Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to promote the PropertyAnination as one property?

How to promote the PropertyAnination as one property?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 3 Posters 1.6k 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.
  • small_birdS Offline
    small_birdS Offline
    small_bird
    wrote on last edited by
    #1
    property PropertyAnimation id: windowEnterAnimation;
    PropertyAnimation {
        id:windowEnterAnimation;
        target: borderItem;
        duration: 500;
        property: 'opacity';
        to: 1;
    }
    

    The code up is in one QML file. Now, I want to call "windowEnterAnimation" in another QML file. The result shows as following:

    qrc:/main.qml:304: TypeError: Cannot call method 'start' of undefined.
    

    Why? Could anyone help me? Thanks in advance!

    YashpalY 1 Reply Last reply
    0
    • small_birdS small_bird
      property PropertyAnimation id: windowEnterAnimation;
      PropertyAnimation {
          id:windowEnterAnimation;
          target: borderItem;
          duration: 500;
          property: 'opacity';
          to: 1;
      }
      

      The code up is in one QML file. Now, I want to call "windowEnterAnimation" in another QML file. The result shows as following:

      qrc:/main.qml:304: TypeError: Cannot call method 'start' of undefined.
      

      Why? Could anyone help me? Thanks in advance!

      YashpalY Offline
      YashpalY Offline
      Yashpal
      wrote on last edited by
      #2

      @small_bird said in How to promote the PropertyAnination as one property?:

      qrc:/main.qml:304: TypeError: Cannot call method 'start' of undefined.

      Can you put minimal code of main.qml?

      small_birdS 1 Reply Last reply
      1
      • 6thC6 Offline
        6thC6 Offline
        6thC
        wrote on last edited by
        #3

        said in How to promote the PropertyAnination as one property?:

        property PropertyAnimation id: windowEnterAnimation;

        Just as a guess:

        property alias propertyAnimation : windowEnterAnimation;
        
        small_birdS 2 Replies Last reply
        0
        • YashpalY Yashpal

          @small_bird said in How to promote the PropertyAnination as one property?:

          qrc:/main.qml:304: TypeError: Cannot call method 'start' of undefined.

          Can you put minimal code of main.qml?

          small_birdS Offline
          small_birdS Offline
          small_bird
          wrote on last edited by
          #4

          @Yashpal

                     Loader{
                         id:imageSequencePlayWindowLoader;
                         asynchronous: true;
                     }
                     ButtonComponent{
                         id:cancelButton;
                         anchors.right: parent.right;
                         anchors.bottom: parent.bottom;
                         anchors.bottomMargin: 10;
                         anchors.rightMargin: 20;
          
                         Image {
                             anchors.centerIn: parent;
                             source: "qrc:/uiElements/cancelMark.png";
                         }
                         source: focus ? "qrc:/uiElements/buttonFocused.png" : "qrc:/uiElements/buttonNormal.png";
                         mouseArea.acceptedButtons: Qt.LeftButton;
                         mouseArea.onClicked: {
                             windowExitAnimation.start();
                             processedImageWindowLoader.item.propertyAnimation.start();
                         }
                     }
          YashpalY 1 Reply Last reply
          0
          • 6thC6 6thC

            said in How to promote the PropertyAnination as one property?:

            property PropertyAnimation id: windowEnterAnimation;

            Just as a guess:

            property alias propertyAnimation : windowEnterAnimation;
            
            small_birdS Offline
            small_birdS Offline
            small_bird
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • 6thC6 6thC

              said in How to promote the PropertyAnination as one property?:

              property PropertyAnimation id: windowEnterAnimation;

              Just as a guess:

              property alias propertyAnimation : windowEnterAnimation;
              
              small_birdS Offline
              small_birdS Offline
              small_bird
              wrote on last edited by
              #6

              @6thC Thanks a lot! It works.

              YashpalY 1 Reply Last reply
              1
              • small_birdS small_bird

                @Yashpal

                           Loader{
                               id:imageSequencePlayWindowLoader;
                               asynchronous: true;
                           }
                           ButtonComponent{
                               id:cancelButton;
                               anchors.right: parent.right;
                               anchors.bottom: parent.bottom;
                               anchors.bottomMargin: 10;
                               anchors.rightMargin: 20;
                
                               Image {
                                   anchors.centerIn: parent;
                                   source: "qrc:/uiElements/cancelMark.png";
                               }
                               source: focus ? "qrc:/uiElements/buttonFocused.png" : "qrc:/uiElements/buttonNormal.png";
                               mouseArea.acceptedButtons: Qt.LeftButton;
                               mouseArea.onClicked: {
                                   windowExitAnimation.start();
                                   processedImageWindowLoader.item.propertyAnimation.start();
                               }
                           }
                YashpalY Offline
                YashpalY Offline
                Yashpal
                wrote on last edited by
                #7

                @small_bird

                1. You have to create an object of windowEnterAnimation component in the main.qml
                2. Then, you can reference windowEnterAnimation.start() from the object that you created.

                What is "imageSequencePlayWindowLoader" Loader for? And, what does "processedImageWindowLoader" for?

                1 Reply Last reply
                0
                • small_birdS small_bird

                  @6thC Thanks a lot! It works.

                  YashpalY Offline
                  YashpalY Offline
                  Yashpal
                  wrote on last edited by
                  #8

                  @small_bird That's cool. You can share the solution here, it would help others.

                  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