aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-01 12:26:22 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-01 20:18:58 +0000
commit154c5e32af4d59cd04ac907d3f66cb0807ff14e9 (patch)
tree5eb940660bc640c09a83cc0a5aeb4cf6127d6531 /src
parentda150839d20a9bfae82b220b3dfe7229d1421e12 (diff)
Doc: fix review findings for ToolButton
Change-Id: Id427520a390a2a8cb0bb4ac0f66fef5f96e5b39e Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-toolbar.pngbin3358 -> 1186 bytes
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml27
-rw-r--r--src/quicktemplates2/qquicktoolbar.cpp17
-rw-r--r--src/quicktemplates2/qquicktoolbutton.cpp6
4 files changed, 37 insertions, 13 deletions
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png b/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png
index f4808ca9..1fe353cc 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png
Binary files differ
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
index fd6754f8..246f3ae5 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -29,19 +29,34 @@ import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.0
+Item {
+ width: children[0].implicitWidth * 2
+ height: children[0].implicitHeight
+ Binding {
+ target: children[0]
+ property: "width"
+ value: width
+ }
//! [1]
ToolBar {
RowLayout {
anchors.fill: parent
ToolButton {
- text: qsTr("\u25C0 Qt")
+ text: qsTr("‹")
onClicked: stack.pop()
}
- Item { Layout.fillWidth: true }
- Switch {
- checked: true
- text: qsTr("Notifications")
+ Label {
+ text: "Title"
+ elide: Label.ElideRight
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ Layout.fillWidth: true
+ }
+ ToolButton {
+ text: qsTr("⋮")
+ onClicked: menu.open()
}
}
}
//! [1]
+}
diff --git a/src/quicktemplates2/qquicktoolbar.cpp b/src/quicktemplates2/qquicktoolbar.cpp
index 5a767c73..e6d705ad 100644
--- a/src/quicktemplates2/qquicktoolbar.cpp
+++ b/src/quicktemplates2/qquicktoolbar.cpp
@@ -69,14 +69,19 @@ QT_BEGIN_NAMESPACE
RowLayout {
anchors.fill: parent
ToolButton {
- text: qsTr("\u25C0 %1").arg(Qt.application.name)
- enabled: stack.depth > 1
+ text: qsTr("‹")
onClicked: stack.pop()
}
- Item { Layout.fillWidth: true }
- Switch {
- checked: true
- text: qsTr("Notifications")
+ Label {
+ text: "Title"
+ elide: Label.ElideRight
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ Layout.fillWidth: true
+ }
+ ToolButton {
+ text: qsTr("⋮")
+ onClicked: menu.open()
}
}
}
diff --git a/src/quicktemplates2/qquicktoolbutton.cpp b/src/quicktemplates2/qquicktoolbutton.cpp
index c1f47b97..8009ac28 100644
--- a/src/quicktemplates2/qquicktoolbutton.cpp
+++ b/src/quicktemplates2/qquicktoolbutton.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
- \brief A button with a layout suitable for a ToolBar.
+ \brief A button with a look suitable for a ToolBar.
ToolButton is functionally similar to \l Button, but provides a look that
is more suitable within a \l ToolBar.
@@ -57,6 +57,10 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-toolbar.qml 1
+ ToolButton inherits its API from AbstractButton. For instance, you can set
+ \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
+ using the AbstractButton API.
+
\sa ToolBar, {Customizing ToolButton}, {Button Controls}
*/