aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/shared
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-01-08 17:30:49 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-04 09:15:22 +0100
commitb45f742dd8c533cff0767d2dfbe68ea9fd19a522 (patch)
tree7a5a7a320a432bb0fa1e7fec6d546d09efd7de56 /examples/quick/shared
parent84c41e4c7e22774e18d1462fcf4ca907a960900c (diff)
adding QtQuick.Dialogs, with FileDialog implementation
This will obsolete the QFileDialogItem in desktop components and be available to all QtQuick applications. The QML FileDialog type is dynamically defined in the plugin by detecting which implementation will work on the current platform. Change-Id: I073c7a84bff6c02cf592dc46822a5a4b9c9bcaea Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'examples/quick/shared')
-rw-r--r--examples/quick/shared/CheckBox.qml102
-rw-r--r--examples/quick/shared/ToolButton.qml93
-rw-r--r--examples/quick/shared/qmldir2
-rw-r--r--examples/quick/shared/quick_shared.qrc2
-rw-r--r--examples/quick/shared/shared.qrc2
5 files changed, 201 insertions, 0 deletions
diff --git a/examples/quick/shared/CheckBox.qml b/examples/quick/shared/CheckBox.qml
new file mode 100644
index 0000000000..1d29430934
--- /dev/null
+++ b/examples/quick/shared/CheckBox.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ height: label.height + 4
+ width: label.width + height + 4
+ property alias text: label.text
+ property bool checked
+ property alias pressed: mouseArea.pressed
+ Rectangle {
+ antialiasing: true
+ border.color: "white"
+ color: "transparent"
+ anchors.fill: gradientRect
+ anchors.rightMargin: 1
+ anchors.bottomMargin: 1
+ radius: 3
+ }
+ Rectangle {
+ border.color: "black"
+ anchors.fill: gradientRect
+ anchors.leftMargin: 1
+ anchors.topMargin: 1
+ radius: 3
+ }
+ Rectangle {
+ id: gradientRect
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: mouseArea.pressed ? "darkgrey" : "#CCCCCC" }
+ GradientStop { position: 0.6; color: "#887766" }
+ GradientStop { position: 1.0; color: mouseArea.pressed ? "white" : "#333333" }
+ }
+ anchors.verticalCenter: parent.verticalCenter
+ height: parent.height
+ width: height
+ anchors.margins: 1
+ radius: 3
+ }
+ Text {
+ id: theX
+ anchors.centerIn: gradientRect
+ text: checked ? "✓" : ""
+ }
+ Text {
+ anchors.centerIn: gradientRect
+ anchors.horizontalCenterOffset: 0.5
+ anchors.verticalCenterOffset: 0.5
+ color: "white"
+ text: theX.text
+ }
+ Text {
+ id: label
+ color: "#EEEEDD"
+ anchors.left: gradientRect.right
+ anchors.leftMargin: 6
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: parent.checked = !parent.checked
+ }
+}
diff --git a/examples/quick/shared/ToolButton.qml b/examples/quick/shared/ToolButton.qml
new file mode 100644
index 0000000000..1af0d13dcf
--- /dev/null
+++ b/examples/quick/shared/ToolButton.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ height: parent.height - 4
+ width: height * 2
+ anchors.verticalCenter: parent.verticalCenter
+ property alias text: label.text
+ property string tooltip
+ signal clicked
+ Rectangle {
+ antialiasing: true
+ border.color: "white"
+ color: "transparent"
+ anchors.fill: parent
+ anchors.rightMargin: 1
+ anchors.bottomMargin: 1
+ radius: 3
+ }
+ Rectangle {
+ border.color: "black"
+ anchors.fill: parent
+ anchors.leftMargin: 1
+ anchors.topMargin: 1
+ radius: 3
+ }
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: mouseArea.pressed ? "darkgrey" : "#CCCCCC" }
+ GradientStop { position: 0.6; color: "#887766" }
+ GradientStop { position: 1.0; color: mouseArea.pressed ? "white" : "#333333" }
+ }
+ anchors.fill: parent
+ anchors.margins: 1
+ radius: 3
+ }
+ Text {
+ id: label
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: 0.5
+ anchors.verticalCenterOffset: 0.5
+ color: "white"
+ text: label.text
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: parent.clicked()
+ }
+}
diff --git a/examples/quick/shared/qmldir b/examples/quick/shared/qmldir
index 106654bbf0..68bd573f85 100644
--- a/examples/quick/shared/qmldir
+++ b/examples/quick/shared/qmldir
@@ -1,4 +1,6 @@
Button 2.0 Button.qml
+CheckBox 2.1 CheckBox.qml
LauncherList 2.0 LauncherList.qml
SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml
Slider 2.0 Slider.qml
+ToolButton 2.1 ToolButton.qml
diff --git a/examples/quick/shared/quick_shared.qrc b/examples/quick/shared/quick_shared.qrc
index 74a964e5ef..aa6a761e0d 100644
--- a/examples/quick/shared/quick_shared.qrc
+++ b/examples/quick/shared/quick_shared.qrc
@@ -3,6 +3,8 @@
<file>LauncherList.qml</file>
<file>SimpleLauncherDelegate.qml</file>
<file>Button.qml</file>
+ <file>CheckBox.qml</file>
+ <file>ToolButton.qml</file>
<file>images/back.png</file>
<file>images/next.png</file>
</qresource>
diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc
index fba2d3eb82..cbc782f2c7 100644
--- a/examples/quick/shared/shared.qrc
+++ b/examples/quick/shared/shared.qrc
@@ -5,6 +5,8 @@
<file>Button.qml</file>
<file>Slider.qml</file>
<file>images/slider_handle.png</file>
+ <file>CheckBox.qml</file>
+ <file>ToolButton.qml</file>
<file>images/back.png</file>
<file>images/next.png</file>
</qresource>