forked from qt-creator/qt-creator
QmlDesigner: Show IconButton tooltip also when button is disabled
Fixes: QDS-7076 Change-Id: If412827e22c6f71a9f073d1c868dcdb325870c1d Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -34,10 +34,10 @@ Rectangle {
|
|||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
property alias icon: icon.text
|
property alias icon: icon.text
|
||||||
property alias enabled: mouseArea.enabled
|
|
||||||
property alias tooltip: toolTip.text
|
property alias tooltip: toolTip.text
|
||||||
property alias iconSize: icon.font.pixelSize
|
property alias iconSize: icon.font.pixelSize
|
||||||
|
|
||||||
|
property bool enabled: true
|
||||||
property int buttonSize: StudioTheme.Values.height
|
property int buttonSize: StudioTheme.Values.height
|
||||||
property color normalColor: StudioTheme.Values.themeControlBackground
|
property color normalColor: StudioTheme.Values.themeControlBackground
|
||||||
property color hoverColor: StudioTheme.Values.themeControlBackgroundHover
|
property color hoverColor: StudioTheme.Values.themeControlBackgroundHover
|
||||||
@@ -46,9 +46,10 @@ Rectangle {
|
|||||||
width: buttonSize
|
width: buttonSize
|
||||||
height: buttonSize
|
height: buttonSize
|
||||||
|
|
||||||
color: mouseArea.pressed ? pressColor
|
color: !enabled ? normalColor
|
||||||
: mouseArea.containsMouse ? hoverColor
|
: mouseArea.pressed ? pressColor
|
||||||
: normalColor
|
: mouseArea.containsMouse ? hoverColor
|
||||||
|
: normalColor
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
@@ -71,7 +72,11 @@ Rectangle {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: root.clicked()
|
onClicked: {
|
||||||
|
// We need to keep mouse area enabled even when button is disabled to make tooltip work
|
||||||
|
if (root.enabled)
|
||||||
|
root.clicked()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip {
|
ToolTip {
|
||||||
|
Reference in New Issue
Block a user