aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/doc
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-05-21 10:17:39 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-06-15 13:25:16 +0000
commitbfb0a9ebe3b1dc6b0f06ec2d66469ba878fbe98b (patch)
tree984345e8bba2d1ba892f159971315b5f0dd786b3 /src/imports/controls/doc
parentbf82b95088f552a5f62d333662c7a9202d293359 (diff)
Add DialogButtonBox
[ChangeLog][Controls] Added DialogButtonBox to provide convenience for handling dialog buttons. DialogButtonBox is able to create a set of standard buttons with a single line of QML code, and provides convenient accepted() and rejected() signals. Task-number: QTBUG-51090 Change-Id: I9b3c6ba1b2836dadf9a2ac9086be1eba214e7c4d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/doc')
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.pngbin0 -> 1993 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.pngbin0 -> 1987 bytes
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml42
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml38
4 files changed, 80 insertions, 0 deletions
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png
new file mode 100644
index 00000000..53ecf83d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png
new file mode 100644
index 00000000..87cece98
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png
Binary files differ
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml
new file mode 100644
index 00000000..a93cda30
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 2.1
+
+//! [1]
+DialogButtonBox {
+ Button {
+ text: qsTr("Save")
+ DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
+ }
+ Button {
+ text: qsTr("Close")
+ DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml
new file mode 100644
index 00000000..41e6cf23
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 2.1
+
+//! [1]
+DialogButtonBox {
+ standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
+
+ onAccepted: console.log("Ok clicked")
+ onRejected: console.log("Cancel clicked")
+}
+//! [1]