forked from qt-creator/qt-creator
QmlDesigner: Add tool tips to disabled anchors
Add tool tips to disabled anchor buttons to make clear what the reason for disabling is. Task-number: QDS-5388 Change-Id: I193ba5ced45a6cb4d90e8475fc992029f58337d3 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
committed by
Henning Gründl
parent
c3334f105a
commit
395b9aa9cf
@@ -34,14 +34,24 @@ StudioControls.ButtonRow {
|
|||||||
enabled: anchorBackend.hasParent && isBaseState
|
enabled: anchorBackend.hasParent && isBaseState
|
||||||
actionIndicatorVisible: false
|
actionIndicatorVisible: false
|
||||||
|
|
||||||
|
function pickToolTip(defaultText) {
|
||||||
|
if (!anchorBackend.hasParent)
|
||||||
|
return qsTr("Anchors can only be applied to child items.")
|
||||||
|
else if (!isBaseState)
|
||||||
|
return qsTr("Anchors can only be applied to the base state.")
|
||||||
|
|
||||||
|
return defaultText
|
||||||
|
}
|
||||||
|
|
||||||
StudioControls.ButtonGroup { id: group }
|
StudioControls.ButtonGroup { id: group }
|
||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
property bool topAnchored: anchorBackend.topAnchored
|
property bool topAnchored: anchorBackend.topAnchored
|
||||||
|
property string toolTipText: qsTr("Anchor component to the top.")
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
buttonIcon: StudioTheme.Constants.anchorTop
|
buttonIcon: StudioTheme.Constants.anchorTop
|
||||||
tooltip: qsTr("Anchor component to the top.")
|
tooltip: buttonRow.pickToolTip(toolTipText)
|
||||||
|
|
||||||
onTopAnchoredChanged: checked = topAnchored
|
onTopAnchoredChanged: checked = topAnchored
|
||||||
|
|
||||||
@@ -59,10 +69,11 @@ StudioControls.ButtonRow {
|
|||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
property bool bottomAnchored: anchorBackend.bottomAnchored
|
property bool bottomAnchored: anchorBackend.bottomAnchored
|
||||||
|
property string toolTipText: qsTr("Anchor component to the bottom.")
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
buttonIcon: StudioTheme.Constants.anchorBottom
|
buttonIcon: StudioTheme.Constants.anchorBottom
|
||||||
tooltip: qsTr("Anchor component to the bottom.")
|
tooltip: buttonRow.pickToolTip(toolTipText)
|
||||||
|
|
||||||
onBottomAnchoredChanged: checked = bottomAnchored
|
onBottomAnchoredChanged: checked = bottomAnchored
|
||||||
|
|
||||||
@@ -80,10 +91,11 @@ StudioControls.ButtonRow {
|
|||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
property bool leftAnchored: anchorBackend.leftAnchored
|
property bool leftAnchored: anchorBackend.leftAnchored
|
||||||
|
property string toolTipText: qsTr("Anchor component to the left.")
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
buttonIcon: StudioTheme.Constants.anchorLeft
|
buttonIcon: StudioTheme.Constants.anchorLeft
|
||||||
tooltip: qsTr("Anchor component to the left.")
|
tooltip: buttonRow.pickToolTip(toolTipText)
|
||||||
|
|
||||||
onLeftAnchoredChanged: checked = leftAnchored
|
onLeftAnchoredChanged: checked = leftAnchored
|
||||||
|
|
||||||
@@ -101,10 +113,11 @@ StudioControls.ButtonRow {
|
|||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
property bool rightAnchored: anchorBackend.rightAnchored
|
property bool rightAnchored: anchorBackend.rightAnchored
|
||||||
|
property string toolTipText: qsTr("Anchor component to the right.")
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
buttonIcon: StudioTheme.Constants.anchorRight
|
buttonIcon: StudioTheme.Constants.anchorRight
|
||||||
tooltip: qsTr("Anchor component to the right.")
|
tooltip: buttonRow.pickToolTip(toolTipText)
|
||||||
|
|
||||||
onRightAnchoredChanged: checked = rightAnchored
|
onRightAnchoredChanged: checked = rightAnchored
|
||||||
|
|
||||||
@@ -126,10 +139,11 @@ StudioControls.ButtonRow {
|
|||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
property bool isFilled: anchorBackend.isFilled
|
property bool isFilled: anchorBackend.isFilled
|
||||||
|
property string toolTipText: qsTr("Fill parent component.")
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
buttonIcon: StudioTheme.Constants.anchorFill
|
buttonIcon: StudioTheme.Constants.anchorFill
|
||||||
tooltip: qsTr("Fill parent component.")
|
tooltip: buttonRow.pickToolTip(toolTipText)
|
||||||
|
|
||||||
onIsFilledChanged: checked = isFilled
|
onIsFilledChanged: checked = isFilled
|
||||||
|
|
||||||
@@ -147,10 +161,11 @@ StudioControls.ButtonRow {
|
|||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
property bool verticalCentered: anchorBackend.verticalCentered
|
property bool verticalCentered: anchorBackend.verticalCentered
|
||||||
|
property string toolTipText: qsTr("Anchor component vertically.")
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
buttonIcon: StudioTheme.Constants.centerVertical
|
buttonIcon: StudioTheme.Constants.centerVertical
|
||||||
tooltip: qsTr("Anchor component vertically.")
|
tooltip: buttonRow.pickToolTip(toolTipText)
|
||||||
|
|
||||||
onVerticalCenteredChanged: checked = verticalCentered
|
onVerticalCenteredChanged: checked = verticalCentered
|
||||||
|
|
||||||
@@ -169,10 +184,11 @@ StudioControls.ButtonRow {
|
|||||||
|
|
||||||
AbstractButton {
|
AbstractButton {
|
||||||
property bool horizontalCentered: anchorBackend.horizontalCentered
|
property bool horizontalCentered: anchorBackend.horizontalCentered
|
||||||
|
property string toolTipText: qsTr("Anchor component horizontally.")
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
buttonIcon: StudioTheme.Constants.centerHorizontal
|
buttonIcon: StudioTheme.Constants.centerHorizontal
|
||||||
tooltip: qsTr("Anchor component horizontally.")
|
tooltip: buttonRow.pickToolTip(toolTipText)
|
||||||
|
|
||||||
onHorizontalCenteredChanged: checked = horizontalCentered
|
onHorizontalCenteredChanged: checked = horizontalCentered
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user