I have a custom QML Buton as shown bellow.
import QtQuick 2.15
import QtQuick.Controls 2.15
Button{
id: dashId
width: 155
height: 40
implicitWidth: 155
implicitHeight: 40
text: 'hello'
flat: true
property color colorNormal: '#353535'
property color colorHovered: '#04b9b9'
property color colorClicked: '#4d4f50'
background: Rectangle{
id: bgColor
radius: 10
color: internal.hoverColor
}
contentItem: Item {
id: buttonItem
visible: true
Text {
id: buttonText
text: dashId.text
anchors.centerIn: parent
color: 'white'
}
}
QtObject{
id: internal
property var hoverColor: if(dashId.down){
dashId.down ? colorClicked : colorNormal
}else{
dashId.hovered ? colorHovered : colorNormal
}
}
}
when hovered, its still have its default hover color on top of custom hover color instead of just custom color.
Am using Qt6 and QtQuick 1.14.1 on Windows 10.
I found the issue.
I had to set highlighted: true
and flat: true
inside my button.