forked from qt-creator/qt-creator
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:
committed by
Thomas Hartmann
parent
995f09d6dc
commit
9f7fe2fb82
@@ -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
|
||||
}
|
||||
}
|
@@ -40,10 +40,10 @@ StudioControls.ButtonRow {
|
||||
id: group
|
||||
}
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
checkable: true
|
||||
buttonIcon: StudioTheme.Constants.anchorTop
|
||||
//tooltip: qsTr("Anchor item to the top.")
|
||||
tooltip: qsTr("Anchor item to the top.")
|
||||
|
||||
property bool topAnchored: anchorBackend.topAnchored
|
||||
onTopAnchoredChanged: {
|
||||
@@ -61,10 +61,10 @@ StudioControls.ButtonRow {
|
||||
}
|
||||
}
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
checkable: true
|
||||
buttonIcon: StudioTheme.Constants.anchorBottom
|
||||
//tooltip: qsTr("Anchor item to the bottom.")
|
||||
tooltip: qsTr("Anchor item to the bottom.")
|
||||
|
||||
property bool bottomAnchored: anchorBackend.bottomAnchored
|
||||
onBottomAnchoredChanged: {
|
||||
@@ -80,13 +80,12 @@ StudioControls.ButtonRow {
|
||||
anchorBackend.bottomAnchored = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
checkable: true
|
||||
buttonIcon: StudioTheme.Constants.anchorLeft
|
||||
//tooltip: qsTr("Anchor item to the left.")
|
||||
tooltip: qsTr("Anchor item to the left.")
|
||||
|
||||
property bool leftAnchored: anchorBackend.leftAnchored
|
||||
onLeftAnchoredChanged: {
|
||||
@@ -104,10 +103,10 @@ StudioControls.ButtonRow {
|
||||
}
|
||||
}
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
checkable: true
|
||||
buttonIcon: StudioTheme.Constants.anchorRight
|
||||
//tooltip: qsTr("Anchor item to the right.")
|
||||
tooltip: qsTr("Anchor item to the right.")
|
||||
|
||||
property bool rightAnchored: anchorBackend.rightAnchored
|
||||
onRightAnchoredChanged: {
|
||||
@@ -125,15 +124,14 @@ StudioControls.ButtonRow {
|
||||
}
|
||||
}
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
enabled: false
|
||||
}
|
||||
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
checkable: true
|
||||
buttonIcon: StudioTheme.Constants.anchorFill
|
||||
//tooltip: qsTr("Fill parent item.")
|
||||
tooltip: qsTr("Fill parent item.")
|
||||
|
||||
property bool isFilled: anchorBackend.isFilled
|
||||
onIsFilledChanged: {
|
||||
@@ -149,14 +147,14 @@ StudioControls.ButtonRow {
|
||||
}
|
||||
}
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
enabled: false
|
||||
}
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
checkable: true
|
||||
buttonIcon: StudioTheme.Constants.centerVertical
|
||||
//tooltip: qsTr("Anchor item vertically.")
|
||||
tooltip: qsTr("Anchor item vertically.")
|
||||
|
||||
property bool verticalCentered: anchorBackend.verticalCentered;
|
||||
onVerticalCenteredChanged: {
|
||||
@@ -176,10 +174,10 @@ StudioControls.ButtonRow {
|
||||
}
|
||||
}
|
||||
|
||||
StudioControls.AbstractButton {
|
||||
AbstractButton {
|
||||
checkable: true
|
||||
buttonIcon: StudioTheme.Constants.centerHorizontal
|
||||
//tooltip: qsTr("Anchor item horizontally.")
|
||||
tooltip: qsTr("Anchor item horizontally.")
|
||||
|
||||
property bool horizontalCentered: anchorBackend.horizontalCentered;
|
||||
onHorizontalCenteredChanged: {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
AbstractButton 2.0 AbstractButton.qml
|
||||
ActionIndicator 2.0 ActionIndicator.qml
|
||||
AligmentHorizontalButtons 2.0 AligmentHorizontalButtons.qml
|
||||
AligmentVerticalButtons 2.0 AligmentVerticalButtons.qml
|
||||
|
Reference in New Issue
Block a user