Qml button color excessive animation style
-
wrote on 1 Jul 2021, 09:03 last edited by
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
-
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
wrote on 1 Jul 2021, 12:20 last edited by@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.12Window {
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/2