QmlDesigner: Add AbstractButton wrapper

Add AbstractButton wrapper to HelperWidgets this enables tooltips
on Buttons again.

Change-Id: If82bfcf3097f9e09d5cc19e4363b2428ad0ca872
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2019-08-23 15:17:26 +02:00
committed by Thomas Hartmann
parent 995f09d6dc
commit 9f7fe2fb82
3 changed files with 59 additions and 18 deletions

View File

@@ -0,0 +1,42 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.1
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
StudioControls.AbstractButton {
id: button
property alias tooltip: toolTipArea.tooltip
ToolTipArea {
id: toolTipArea
anchors.fill: parent
// Without setting the acceptedButtons property the clicked event won't
// reach the AbstractButton, it will be consumed by the ToolTipArea
acceptedButtons: Qt.NoButton
}
}

View File

@@ -40,10 +40,10 @@ StudioControls.ButtonRow {
id: group id: group
} }
StudioControls.AbstractButton { AbstractButton {
checkable: true checkable: true
buttonIcon: StudioTheme.Constants.anchorTop buttonIcon: StudioTheme.Constants.anchorTop
//tooltip: qsTr("Anchor item to the top.") tooltip: qsTr("Anchor item to the top.")
property bool topAnchored: anchorBackend.topAnchored property bool topAnchored: anchorBackend.topAnchored
onTopAnchoredChanged: { onTopAnchoredChanged: {
@@ -61,10 +61,10 @@ StudioControls.ButtonRow {
} }
} }
StudioControls.AbstractButton { AbstractButton {
checkable: true checkable: true
buttonIcon: StudioTheme.Constants.anchorBottom buttonIcon: StudioTheme.Constants.anchorBottom
//tooltip: qsTr("Anchor item to the bottom.") tooltip: qsTr("Anchor item to the bottom.")
property bool bottomAnchored: anchorBackend.bottomAnchored property bool bottomAnchored: anchorBackend.bottomAnchored
onBottomAnchoredChanged: { onBottomAnchoredChanged: {
@@ -80,13 +80,12 @@ StudioControls.ButtonRow {
anchorBackend.bottomAnchored = false; anchorBackend.bottomAnchored = false;
} }
} }
} }
StudioControls.AbstractButton { AbstractButton {
checkable: true checkable: true
buttonIcon: StudioTheme.Constants.anchorLeft buttonIcon: StudioTheme.Constants.anchorLeft
//tooltip: qsTr("Anchor item to the left.") tooltip: qsTr("Anchor item to the left.")
property bool leftAnchored: anchorBackend.leftAnchored property bool leftAnchored: anchorBackend.leftAnchored
onLeftAnchoredChanged: { onLeftAnchoredChanged: {
@@ -104,10 +103,10 @@ StudioControls.ButtonRow {
} }
} }
StudioControls.AbstractButton { AbstractButton {
checkable: true checkable: true
buttonIcon: StudioTheme.Constants.anchorRight buttonIcon: StudioTheme.Constants.anchorRight
//tooltip: qsTr("Anchor item to the right.") tooltip: qsTr("Anchor item to the right.")
property bool rightAnchored: anchorBackend.rightAnchored property bool rightAnchored: anchorBackend.rightAnchored
onRightAnchoredChanged: { onRightAnchoredChanged: {
@@ -125,15 +124,14 @@ StudioControls.ButtonRow {
} }
} }
StudioControls.AbstractButton { AbstractButton {
enabled: false enabled: false
} }
AbstractButton {
StudioControls.AbstractButton {
checkable: true checkable: true
buttonIcon: StudioTheme.Constants.anchorFill buttonIcon: StudioTheme.Constants.anchorFill
//tooltip: qsTr("Fill parent item.") tooltip: qsTr("Fill parent item.")
property bool isFilled: anchorBackend.isFilled property bool isFilled: anchorBackend.isFilled
onIsFilledChanged: { onIsFilledChanged: {
@@ -149,14 +147,14 @@ StudioControls.ButtonRow {
} }
} }
StudioControls.AbstractButton { AbstractButton {
enabled: false enabled: false
} }
StudioControls.AbstractButton { AbstractButton {
checkable: true checkable: true
buttonIcon: StudioTheme.Constants.centerVertical buttonIcon: StudioTheme.Constants.centerVertical
//tooltip: qsTr("Anchor item vertically.") tooltip: qsTr("Anchor item vertically.")
property bool verticalCentered: anchorBackend.verticalCentered; property bool verticalCentered: anchorBackend.verticalCentered;
onVerticalCenteredChanged: { onVerticalCenteredChanged: {
@@ -176,10 +174,10 @@ StudioControls.ButtonRow {
} }
} }
StudioControls.AbstractButton { AbstractButton {
checkable: true checkable: true
buttonIcon: StudioTheme.Constants.centerHorizontal buttonIcon: StudioTheme.Constants.centerHorizontal
//tooltip: qsTr("Anchor item horizontally.") tooltip: qsTr("Anchor item horizontally.")
property bool horizontalCentered: anchorBackend.horizontalCentered; property bool horizontalCentered: anchorBackend.horizontalCentered;
onHorizontalCenteredChanged: { onHorizontalCenteredChanged: {

View File

@@ -1,3 +1,4 @@
AbstractButton 2.0 AbstractButton.qml
ActionIndicator 2.0 ActionIndicator.qml ActionIndicator 2.0 ActionIndicator.qml
AligmentHorizontalButtons 2.0 AligmentHorizontalButtons.qml AligmentHorizontalButtons 2.0 AligmentHorizontalButtons.qml
AligmentVerticalButtons 2.0 AligmentVerticalButtons.qml AligmentVerticalButtons 2.0 AligmentVerticalButtons.qml