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()
|
||||
|
||||
property alias icon: icon.text
|
||||
property alias enabled: mouseArea.enabled
|
||||
property alias tooltip: toolTip.text
|
||||
property alias iconSize: icon.font.pixelSize
|
||||
|
||||
property bool enabled: true
|
||||
property int buttonSize: StudioTheme.Values.height
|
||||
property color normalColor: StudioTheme.Values.themeControlBackground
|
||||
property color hoverColor: StudioTheme.Values.themeControlBackgroundHover
|
||||
@@ -46,7 +46,8 @@ Rectangle {
|
||||
width: buttonSize
|
||||
height: buttonSize
|
||||
|
||||
color: mouseArea.pressed ? pressColor
|
||||
color: !enabled ? normalColor
|
||||
: mouseArea.pressed ? pressColor
|
||||
: mouseArea.containsMouse ? hoverColor
|
||||
: normalColor
|
||||
|
||||
@@ -71,7 +72,11 @@ Rectangle {
|
||||
|
||||
anchors.fill: parent
|
||||
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 {
|
||||
|
Reference in New Issue
Block a user