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

Qml button color excessive animation style

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 285 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 1 Jul 2021, 09:03 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

    C 1 Reply Last reply 1 Jul 2021, 12:20
    0
    • N Nan Feng
      1 Jul 2021, 09:03

      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

      C Offline
      C Offline
      CP71
      wrote on 1 Jul 2021, 12:20 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

      1/2

      1 Jul 2021, 09:03

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved