aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-25 14:28:44 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-25 20:44:30 +0000
commit7fde2f9e831fd24b1aa51e827ff59d072468d21d (patch)
tree1c61ce0ebc9b20e7d60e32cafbf1b568021e7de8 /src
parent636609c203becdba014e0eecb7b229a25eaf55f4 (diff)
Docs: ToolBar & ToolButton
Change-Id: Id559849e0eb121a8f23f7dab44cbfbf781f0f805 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/doc/src/qtquickcontrols2-customize.qdoc2
-rw-r--r--src/controls/qquicktoolbar.cpp42
-rw-r--r--src/controls/qquicktoolbutton.cpp26
3 files changed, 67 insertions, 3 deletions
diff --git a/src/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/controls/doc/src/qtquickcontrols2-customize.qdoc
index 0500a085..c070b8e5 100644
--- a/src/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -358,7 +358,7 @@
\section1 Customizing ToolButton
ToolButton consists of two visual items: \l {Control::background}{background}
- and \l {ToolButton::label}{label}.
+ and \l {Button::label}{label}.
\section3 Background
diff --git a/src/controls/qquicktoolbar.cpp b/src/controls/qquicktoolbar.cpp
index 9418c491..297114c5 100644
--- a/src/controls/qquicktoolbar.cpp
+++ b/src/controls/qquicktoolbar.cpp
@@ -46,7 +46,47 @@ QT_BEGIN_NAMESPACE
\ingroup containers
\brief A tool bar control.
- TODO
+ ToolBar is a container of application-wide and context sensitive
+ actions and controls, such as navigation buttons and search fields.
+ ToolBar is commonly used as a \l {ApplicationWindow::header}{header}
+ or a \l {ApplicationWindow::footer}{footer} of an \l ApplicationWindow.
+
+ ToolBar does not provide a layout of its own, but requires you to
+ position its contents, for instance by creating a \l RowLayout. If only
+ a single item is used within the ToolBar, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ ### TODO: screenshot
+
+ \code
+ ApplicationWindow {
+ visible:true
+
+ header: ToolBar {
+ RowLayout {
+ anchors.fill: parent
+ ToolButton {
+ text: qsTr("< %1").arg(Qt.application.name)
+ enabled: stack.depth > 1
+ onClicked: stack.pop()
+ }
+ Item { Layout.fillWidth: true }
+ Switch {
+ checked: true
+ text: qsTr("Notifications")
+ }
+ }
+ }
+
+ StackView {
+ id: stack
+ anchors.fill: parent
+ }
+ }
+ \endcode
+
+ \sa ApplicationWindow, ToolButton, {Customizing ToolBar}
*/
QQuickToolBar::QQuickToolBar(QQuickItem *parent) :
diff --git a/src/controls/qquicktoolbutton.cpp b/src/controls/qquicktoolbutton.cpp
index 12a8f9f3..b913494e 100644
--- a/src/controls/qquicktoolbutton.cpp
+++ b/src/controls/qquicktoolbutton.cpp
@@ -46,7 +46,31 @@ QT_BEGIN_NAMESPACE
\ingroup buttons
\brief A tool button control.
- TODO
+ ToolButton is functionally similar to \l Button, but provides a look that
+ is more suitable within a \l ToolBar.
+
+ ### TODO: screenshot
+
+ \code
+ ToolBar {
+ RowLayout {
+ anchors.fill: parent
+ ToolButton {
+ text: qsTr("< %1").arg(Qt.application.name)
+ enabled: stack.depth > 1
+ onClicked: stack.pop()
+ }
+ Item { Layout.fillWidth: true }
+ ToolButton {
+ text: qsTr("< %1").arg(Qt.application.name)
+ enabled: stack.depth > 1
+ onClicked: stack.pop()
+ }
+ }
+ }
+ \endcode
+
+ \sa ToolBar, {Customizing ToolButton}
*/
QQuickToolButton::QQuickToolButton(QQuickItem *parent) :