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. Rotate Animation
Forum Updated to NodeBB v4.3 + New Features

Rotate Animation

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 3.0k Views 1 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.
  • A Offline
    A Offline
    Anh Phan
    wrote on last edited by
    #1

    I want to make a rotate animation with QPropertyAnimation but i don't know how to do it, can someone help me to do it?

    Anh

    ? 1 Reply Last reply
    0
    • A Anh Phan

      I want to make a rotate animation with QPropertyAnimation but i don't know how to do it, can someone help me to do it?

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      @Anh-Phan Hi! What is it you want to rotate?

      A 1 Reply Last reply
      0
      • ? A Former User

        @Anh-Phan Hi! What is it you want to rotate?

        A Offline
        A Offline
        Anh Phan
        wrote on last edited by
        #3

        @Wieland i want to rotate a pushbutton or qlabel, can you help me?

        Anh

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          I think the easiest way to achieve this is to implement a custom QGraphicsEffect for rotation. You can then apply this to whatever widget you like and you can animate the rotation with QPropertyAnimation.

          1 Reply Last reply
          1
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            BTW: If you need a fancy interface use QtQuick. It makes such things much easier:

            import QtQuick 2.6
            import QtQuick.Window 2.2
            import QtQuick.Controls 1.4
            
            Window {
                visible: true
            
                Button {
                    id: btn
                    anchors.centerIn: parent
                    text: "Exit"
                    onClicked: Qt.quit()
            
                    transform: Rotation {
                        origin.x: btn.width/2.0; origin.y: btn.height/2.0; angle: 0
                        SequentialAnimation on angle {
                            loops: Animation.Infinite
                            PropertyAnimation { to: 360; duration: 1000 }
                            PropertyAnimation { to: 0; duration: 2000 }
                        }
                    }
                }
            }
            
            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