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. Qml button color excessive animation style
Qt 6.11 is out! See what's new in the release blog

Qml button color excessive animation style

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 768 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.
  • N Offline
    N Offline
    Nan Feng
    wrote on last edited by
    #1

    Can the Qml button set the color transition effect? If you can, please give me a sample link, I can't find it. Have been looking for it all morning

    CP71C 1 Reply Last reply
    0
    • N Nan Feng

      Can the Qml button set the color transition effect? If you can, please give me a sample link, I can't find it. Have been looking for it all morning

      CP71C Offline
      CP71C Offline
      CP71
      wrote on last edited by
      #2

      @Nan-Feng
      Hi,
      remember, I'm not a qml developer, so more I can’t help you, sorry! :(

      But this link can help you https://doc.qt.io/qt-5/qtquick-statesanimations-animations.html

      Only to start, chenk my code well, it is only a test:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import QtQuick.Controls 2.12

      Window {
      width: 640
      height: 480
      visible: true
      title: qsTr("Hello World")

      Button {
          id: button
          x: 44
          y: 45
          width: 166
          height: 69
          text: qsTr("Button")
      
          background: Rectangle {
              id: rect
              color: "blue"
      
              states: [
                  State {
                      name: "change"; when: button.pressed
                      PropertyChanges { target: rect; color: "blue" }
                  }
              ]
      
              transitions: Transition {
                  ColorAnimation { to: "red"; duration: 1000 }
              }
          }
      }
      

      }

      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