aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/dialogs')
-rw-r--r--src/imports/dialogs/DefaultColorDialog.qml316
-rw-r--r--src/imports/dialogs/WidgetColorDialog.qml44
-rw-r--r--src/imports/dialogs/dialogs.pro14
-rw-r--r--src/imports/dialogs/images/checkers.pngbin0 -> 149 bytes
-rw-r--r--src/imports/dialogs/images/copy.pngbin0 -> 1338 bytes
-rw-r--r--src/imports/dialogs/images/crosshairs.pngbin0 -> 876 bytes
-rw-r--r--src/imports/dialogs/images/slider_handle.pngbin0 -> 1551 bytes
-rw-r--r--src/imports/dialogs/images/sunken_frame.pngbin0 -> 623 bytes
-rw-r--r--src/imports/dialogs/plugin.cpp12
-rwxr-xr-xsrc/imports/dialogs/qml/ColorSlider.qml138
-rw-r--r--src/imports/dialogs/qml/TextField.qml13
-rw-r--r--src/imports/dialogs/qml/qmldir1
-rw-r--r--src/imports/dialogs/qquickabstractcolordialog.cpp115
-rw-r--r--src/imports/dialogs/qquickabstractcolordialog_p.h100
-rw-r--r--src/imports/dialogs/qquickcolordialog.cpp125
-rw-r--r--src/imports/dialogs/qquickcolordialog_p.h80
-rw-r--r--src/imports/dialogs/qquickplatformcolordialog.cpp237
-rw-r--r--src/imports/dialogs/qquickplatformcolordialog_p.h78
18 files changed, 1272 insertions, 1 deletions
diff --git a/src/imports/dialogs/DefaultColorDialog.qml b/src/imports/dialogs/DefaultColorDialog.qml
new file mode 100644
index 0000000000..7322aa18e7
--- /dev/null
+++ b/src/imports/dialogs/DefaultColorDialog.qml
@@ -0,0 +1,316 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module 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.1
+import QtQuick.Dialogs 1.0
+import "qml"
+
+AbstractColorDialog {
+ id: root
+
+ Rectangle {
+ id: content
+ width: 320
+ height: (usePaletteMap ? width : 0) + bottomMinHeight
+ color: palette.window
+ property real bottomMinHeight: sliders.height + buttonRow.height + outerSpacing * 3
+ property real spacing: 8
+ property real outerSpacing: 12
+ property bool usePaletteMap: true
+ property bool inited: false
+
+ SystemPalette { id: palette }
+
+ Binding {
+ target: root
+ property: "color"
+ value: Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ }
+
+ Item {
+ id: paletteFrame
+ visible: content.usePaletteMap
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ margins: content.outerSpacing
+ }
+ height: Math.min(content.height - content.bottomMinHeight, content.width - content.outerSpacing * 2)
+
+ Image {
+ id: paletteMap
+ x: (parent.width - width) / 2
+ width: height
+ height: parent.height
+ source: "images/checkers.png"
+ fillMode: Image.Tile
+
+ // note we smoothscale the shader from a smaller version to improve performance
+ ShaderEffect {
+ id: map
+ width: 64
+ height: 64
+ opacity: alphaSlider.value
+ scale: paletteMap.width / width;
+ layer.enabled: true
+ layer.smooth: true
+ anchors.centerIn: parent
+ property real hue: hueSlider.value
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform highp float hue;
+
+ highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
+ h = fract(h);
+ if (h < 1.0 / 6.0)
+ return v1 + (v2 - v1) * 6.0 * h;
+ else if (h < 1.0 / 2.0)
+ return v2;
+ else if (h < 2.0 / 3.0)
+ return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
+
+ return v1;
+ }
+
+ highp vec3 HSLtoRGB(highp vec3 color) {
+ highp float h = color.x;
+ highp float l = color.z;
+ highp float s = color.y;
+
+ if (s < 1.0 / 256.0)
+ return vec3(l, l, l);
+
+ highp float v1;
+ highp float v2;
+ if (l < 0.5)
+ v2 = l * (1.0 + s);
+ else
+ v2 = (l + s) - (s * l);
+
+ v1 = 2.0 * l - v2;
+
+ highp float d = 1.0 / 3.0;
+ highp float r = hueToIntensity(v1, v2, h + d);
+ highp float g = hueToIntensity(v1, v2, h);
+ highp float b = hueToIntensity(v1, v2, h - d);
+ return vec3(r, g, b);
+ }
+
+ void main() {
+ lowp vec4 c = vec4(1.0);
+ c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s));
+ gl_FragColor = c * qt_Opacity;
+ }
+ "
+ }
+
+ MouseArea {
+ id: mapMouseArea
+ anchors.fill: parent
+ onPositionChanged: {
+ if (pressed && containsMouse) {
+ var xx = Math.max(0, Math.min(mouse.x, parent.width))
+ var yy = Math.max(0, Math.min(mouse.y, parent.height))
+ saturationSlider.value = 1.0 - yy / parent.height
+ lightnessSlider.value = xx / parent.width
+ // TODO if we constrain the movement here, can avoid the containsMouse test
+ crosshairs.x = mouse.x - crosshairs.radius
+ crosshairs.y = mouse.y - crosshairs.radius
+ }
+ }
+ onPressed: positionChanged(mouse)
+ }
+
+ Image {
+ id: crosshairs
+ property int radius: width / 2 // truncated to int
+ source: "images/crosshairs.png"
+ }
+
+ BorderImage {
+ anchors.fill: parent
+ anchors.margins: -1
+ anchors.leftMargin: -2
+ source: "images/sunken_frame.png"
+ border.left: 8
+ border.right: 8
+ border.top: 8
+ border.bottom: 8
+ }
+ }
+ }
+
+ Column {
+ id: sliders
+ anchors {
+ top: paletteFrame.bottom
+ left: parent.left
+ right: parent.right
+ margins: content.outerSpacing
+ }
+ spacing: content.spacing
+
+ ColorSlider {
+ id: hueSlider
+ value: 0.5
+ text: qsTr("Hue")
+ trackDelegate: Rectangle {
+ rotation: -90
+ transformOrigin: Item.TopLeft
+ gradient: Gradient {
+ GradientStop {position: 0.000; color: Qt.rgba(1, 0, 0, 1)}
+ GradientStop {position: 0.167; color: Qt.rgba(1, 1, 0, 1)}
+ GradientStop {position: 0.333; color: Qt.rgba(0, 1, 0, 1)}
+ GradientStop {position: 0.500; color: Qt.rgba(0, 1, 1, 1)}
+ GradientStop {position: 0.667; color: Qt.rgba(0, 0, 1, 1)}
+ GradientStop {position: 0.833; color: Qt.rgba(1, 0, 1, 1)}
+ GradientStop {position: 1.000; color: Qt.rgba(1, 0, 0, 1)}
+ }
+ }
+ }
+
+ ColorSlider {
+ id: saturationSlider
+ visible: !content.usePaletteMap
+ value: 0.5
+ text: qsTr("Saturation")
+ trackDelegate: Rectangle {
+ rotation: -90
+ transformOrigin: Item.TopLeft
+ gradient: Gradient {
+ GradientStop { position: 0; color: Qt.hsla(hueSlider.value, 0.0, lightnessSlider.value, 1.0) }
+ GradientStop { position: 1; color: Qt.hsla(hueSlider.value, 1.0, lightnessSlider.value, 1.0) }
+ }
+ }
+ }
+
+ ColorSlider {
+ id: lightnessSlider
+ visible: !content.usePaletteMap
+ value: 0.5
+ text: qsTr("Luminosity")
+ trackDelegate: Rectangle {
+ rotation: -90
+ transformOrigin: Item.TopLeft
+ gradient: Gradient {
+ GradientStop { position: 0; color: "black" }
+ GradientStop { position: 0.5; color: Qt.hsla(hueSlider.value, saturationSlider.value, 0.5, 1.0) }
+ GradientStop { position: 1; color: "white" }
+ }
+ }
+ }
+
+ ColorSlider {
+ id: alphaSlider
+ minimum: 0.0
+ maximum: 1.0
+ value: 1.0
+ text: qsTr("Alpha")
+ visible: root.showAlphaChannel
+ trackDelegate: Item {
+ rotation: -90
+ transformOrigin: Item.TopLeft
+ Image {
+ anchors {fill: parent}
+ source: "images/checkers.png"
+ fillMode: Image.TileVertically
+ }
+ Rectangle {
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop { position: 0; color: "transparent" }
+ GradientStop { position: 1; color: Qt.hsla(hueSlider.value,
+ saturationSlider.value,
+ lightnessSlider.value, 1.0) }
+ } }
+ }
+ }
+ }
+
+ Item {
+ id: buttonRow
+ height: buttonsOnly.height
+ width: parent.width
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: content.bottom
+ margins: content.outerSpacing
+ }
+ Row {
+ spacing: content.spacing
+ TextField {
+ id: colorField
+ text: root.color
+ anchors.verticalCenter: parent.verticalCenter
+ onAccepted: root.color = text
+ Component.onCompleted: width = implicitWidth + 10
+ }
+ Image {
+ id: copyIcon
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/copy.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: colorField.copyAll()
+ }
+ }
+ }
+ Row {
+ id: buttonsOnly
+ spacing: content.spacing
+ anchors.right: parent.right
+ Button {
+ id: cancelButton
+ text: "Cancel"
+ onClicked: root.reject()
+ }
+ Button {
+ id: okButton
+ text: "OK"
+ onClicked: root.accept()
+ }
+ }
+ }
+ }
+}
diff --git a/src/imports/dialogs/WidgetColorDialog.qml b/src/imports/dialogs/WidgetColorDialog.qml
new file mode 100644
index 0000000000..ed7c7ab77a
--- /dev/null
+++ b/src/imports/dialogs/WidgetColorDialog.qml
@@ -0,0 +1,44 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module 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.1
+import QtQuick.PrivateWidgets 1.0
+
+QtColorDialog { }
diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro
index ec425c1b4f..b7704dadda 100644
--- a/src/imports/dialogs/dialogs.pro
+++ b/src/imports/dialogs/dialogs.pro
@@ -7,6 +7,9 @@ SOURCES += \
qquickabstractfiledialog.cpp \
qquickplatformfiledialog.cpp \
qquickfiledialog.cpp \
+ qquickabstractcolordialog.cpp \
+ qquickplatformcolordialog.cpp \
+ qquickcolordialog.cpp \
qquickabstractdialog.cpp \
plugin.cpp
@@ -14,14 +17,25 @@ HEADERS += \
qquickabstractfiledialog_p.h \
qquickplatformfiledialog_p.h \
qquickfiledialog_p.h \
+ qquickabstractcolordialog_p.h \
+ qquickplatformcolordialog_p.h \
+ qquickcolordialog_p.h \
qquickabstractdialog_p.h
QML_FILES += \
DefaultFileDialog.qml \
WidgetFileDialog.qml \
+ DefaultColorDialog.qml \
+ WidgetColorDialog.qml \
qml/Button.qml \
+ qml/ColorSlider.qml \
qml/TextField.qml \
qml/qmldir \
+ images/checkers.png \
+ images/copy.png \
+ images/crosshairs.png \
+ images/slider_handle.png \
+ images/sunken_frame.png \
images/folder.png \
images/up.png
diff --git a/src/imports/dialogs/images/checkers.png b/src/imports/dialogs/images/checkers.png
new file mode 100644
index 0000000000..458d33de9d
--- /dev/null
+++ b/src/imports/dialogs/images/checkers.png
Binary files differ
diff --git a/src/imports/dialogs/images/copy.png b/src/imports/dialogs/images/copy.png
new file mode 100644
index 0000000000..2aeb28288f
--- /dev/null
+++ b/src/imports/dialogs/images/copy.png
Binary files differ
diff --git a/src/imports/dialogs/images/crosshairs.png b/src/imports/dialogs/images/crosshairs.png
new file mode 100644
index 0000000000..9a61946eca
--- /dev/null
+++ b/src/imports/dialogs/images/crosshairs.png
Binary files differ
diff --git a/src/imports/dialogs/images/slider_handle.png b/src/imports/dialogs/images/slider_handle.png
new file mode 100644
index 0000000000..e3b9654392
--- /dev/null
+++ b/src/imports/dialogs/images/slider_handle.png
Binary files differ
diff --git a/src/imports/dialogs/images/sunken_frame.png b/src/imports/dialogs/images/sunken_frame.png
new file mode 100644
index 0000000000..178c3092d2
--- /dev/null
+++ b/src/imports/dialogs/images/sunken_frame.png
Binary files differ
diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp
index f7d72bf496..67653e5965 100644
--- a/src/imports/dialogs/plugin.cpp
+++ b/src/imports/dialogs/plugin.cpp
@@ -44,6 +44,9 @@
#include "qquickfiledialog_p.h"
#include "qquickabstractfiledialog_p.h"
#include "qquickplatformfiledialog_p.h"
+#include "qquickcolordialog_p.h"
+#include "qquickabstractcolordialog_p.h"
+#include "qquickplatformcolordialog_p.h"
#include <private/qguiapplication_p.h>
//#define PURE_QML_ONLY
@@ -95,6 +98,15 @@ public:
#endif
registerWidgetOrQmlImplementation<QQuickFileDialog>(widgetsDir, "WidgetFileDialog.qml",
qmlDir, "DefaultFileDialog.qml", "FileDialog", uri);
+
+ // ColorDialog
+#ifndef PURE_QML_ONLY
+ if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::ColorDialog))
+ qmlRegisterType<QQuickPlatformColorDialog>(uri, DIALOGS_MAJOR_MINOR, "ColorDialog");
+ else
+#endif
+ registerWidgetOrQmlImplementation<QQuickColorDialog>(widgetsDir, "WidgetColorDialog.qml",
+ qmlDir, "DefaultColorDialog.qml", "ColorDialog", uri);
}
protected:
diff --git a/src/imports/dialogs/qml/ColorSlider.qml b/src/imports/dialogs/qml/ColorSlider.qml
new file mode 100755
index 0000000000..8fc9717380
--- /dev/null
+++ b/src/imports/dialogs/qml/ColorSlider.qml
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $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.1
+
+Item {
+ id: colorSlider
+
+ property real value: 1
+ property real maximum: 1
+ property real minimum: 0
+ property string text: ""
+ property bool pressed: mouseArea.pressed
+ property bool integer: false
+ property Component trackDelegate
+ property string handleSource: "../images/slider_handle.png"
+
+ width: parent.width
+ height: handle.height + textText.implicitHeight
+
+ function updatePos() {
+ if (maximum > minimum) {
+ var pos = (track.width - 10) * (value - minimum) / (maximum - minimum) + 5;
+ return Math.min(Math.max(pos, 5), track.width - 5) - 10;
+ } else {
+ return 5;
+ }
+ }
+
+ SystemPalette { id: palette }
+
+ Column {
+ id: column
+ width: parent.width
+ spacing: 12
+ Text {
+ id: textText
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: colorSlider.text
+ anchors.left: parent.left
+ color: palette.windowText
+ }
+
+ Item {
+ id: track
+ height: 8
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Loader {
+ sourceComponent: trackDelegate
+ width: parent.height
+ height: parent.width
+ y: width
+ }
+
+ BorderImage {
+ source: "../images/sunken_frame.png"
+ border.left: 8
+ border.right: 8
+ border.top:8
+ border.bottom: 8
+ anchors.fill: track
+ anchors.margins: -1
+ anchors.topMargin: -2
+ anchors.leftMargin: -2
+ }
+
+ Image {
+ id: handle
+ anchors.verticalCenter: parent.verticalCenter
+ smooth: true
+ source: "../images/slider_handle.png"
+ x: updatePos() - 8
+ z: 1
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors {left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
+ height: handle.height
+ width: handle.width
+ preventStealing: true
+
+ onPressed: {
+ var handleX = Math.max(0, Math.min(mouseX, mouseArea.width))
+ var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum;
+ value = colorSlider.integer ? Math.round(realValue) : realValue;
+ }
+
+ onPositionChanged: {
+ if (pressed) {
+ var handleX = Math.max(0, Math.min(mouseX, mouseArea.width))
+ var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum;
+ value = colorSlider.integer ? Math.round(realValue) : realValue;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/imports/dialogs/qml/TextField.qml b/src/imports/dialogs/qml/TextField.qml
index 89487e82ca..baa469caa9 100644
--- a/src/imports/dialogs/qml/TextField.qml
+++ b/src/imports/dialogs/qml/TextField.qml
@@ -45,11 +45,20 @@ Item {
property alias textInput: textInput
property alias text: textInput.text
+ property real implicitWidth: textInput.implicitWidth + rect.radius * 2
+ property real implicitHeight: textInput.implicitHeight + rect.radius * 2
signal accepted
signal downPressed
+ function copyAll() {
+ textInput.selectAll()
+ textInput.copy()
+ }
+
SystemPalette { id: palette }
- height: textInput.implicitHeight + 4
+ height: textInput.implicitHeight + 8
+ clip: true
+
Rectangle {
id: rect
anchors.fill: parent
@@ -62,6 +71,8 @@ Item {
id: textInput
color: palette.text
anchors.fill: parent
+ anchors.leftMargin: rect.radius
+ anchors.rightMargin: rect.radius
verticalAlignment: Text.AlignVCenter
onAccepted: root.accepted()
Keys.onDownPressed: root.downPressed()
diff --git a/src/imports/dialogs/qml/qmldir b/src/imports/dialogs/qml/qmldir
index 85575c738a..c475502cf1 100644
--- a/src/imports/dialogs/qml/qmldir
+++ b/src/imports/dialogs/qml/qmldir
@@ -1,2 +1,3 @@
Button 1.0 Button.qml
+ColorSlider 1.0 ColorSlider.qml
TextField 1.0 TextField.qml
diff --git a/src/imports/dialogs/qquickabstractcolordialog.cpp b/src/imports/dialogs/qquickabstractcolordialog.cpp
new file mode 100644
index 0000000000..9a9f3bc11b
--- /dev/null
+++ b/src/imports/dialogs/qquickabstractcolordialog.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractcolordialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+QQuickAbstractColorDialog::QQuickAbstractColorDialog(QObject *parent)
+ : QQuickAbstractDialog(parent)
+ , m_dlgHelper(0)
+ , m_options(QSharedPointer<QColorDialogOptions>(new QColorDialogOptions()))
+{
+ // On the Mac, modality doesn't work unless you call exec(). But this is a reasonable default anyway.
+ m_modality = Qt::NonModal;
+ connect(this, SIGNAL(accepted()), this, SIGNAL(selectionAccepted()));
+}
+
+QQuickAbstractColorDialog::~QQuickAbstractColorDialog()
+{
+}
+
+void QQuickAbstractColorDialog::setVisible(bool v)
+{
+ if (helper() && v) {
+ m_dlgHelper->setOptions(m_options);
+ }
+ QQuickAbstractDialog::setVisible(v);
+}
+
+void QQuickAbstractColorDialog::setModality(Qt::WindowModality m)
+{
+#ifdef Q_OS_MAC
+ // On the Mac, modality doesn't work unless you call exec()
+ m_modality = Qt::NonModal;
+ emit modalityChanged();
+ return;
+#endif
+ QQuickAbstractDialog::setModality(m);
+}
+
+QString QQuickAbstractColorDialog::title() const
+{
+ return m_options->windowTitle();
+}
+
+bool QQuickAbstractColorDialog::showAlphaChannel() const
+{
+ return m_options->testOption(QColorDialogOptions::ShowAlphaChannel);
+}
+
+void QQuickAbstractColorDialog::setTitle(QString t)
+{
+ if (m_options->windowTitle() == t) return;
+ m_options->setWindowTitle(t);
+ emit titleChanged();
+}
+
+void QQuickAbstractColorDialog::setColor(QColor arg)
+{
+ if (m_color != arg) {
+ m_color = arg;
+ emit colorChanged();
+ }
+}
+
+void QQuickAbstractColorDialog::setShowAlphaChannel(bool arg)
+{
+ m_options->setOption(QColorDialogOptions::ShowAlphaChannel, arg);
+ emit showAlphaChannelChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickabstractcolordialog_p.h b/src/imports/dialogs/qquickabstractcolordialog_p.h
new file mode 100644
index 0000000000..3301605c86
--- /dev/null
+++ b/src/imports/dialogs/qquickabstractcolordialog_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCOLORDIALOG_P_H
+#define QQUICKABSTRACTCOLORDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml>
+#include <QQuickView>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <qpa/qplatformtheme.h>
+#include "qquickabstractdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractColorDialog : public QQuickAbstractDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(bool showAlphaChannel READ showAlphaChannel WRITE setShowAlphaChannel NOTIFY showAlphaChannelChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+
+public:
+ QQuickAbstractColorDialog(QObject *parent = 0);
+ virtual ~QQuickAbstractColorDialog();
+
+ virtual QString title() const;
+ bool showAlphaChannel() const;
+ QColor color() const { return m_color; }
+
+public Q_SLOTS:
+ void setVisible(bool v);
+ void setModality(Qt::WindowModality m);
+ void setTitle(QString t);
+ void setColor(QColor arg);
+ void setShowAlphaChannel(bool arg);
+
+Q_SIGNALS:
+ void showAlphaChannelChanged();
+ void colorChanged();
+ void selectionAccepted();
+
+protected:
+ QPlatformColorDialogHelper *m_dlgHelper;
+ QSharedPointer<QColorDialogOptions> m_options;
+ QColor m_color;
+
+ Q_DISABLE_COPY(QQuickAbstractColorDialog)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCOLORDIALOG_P_H
diff --git a/src/imports/dialogs/qquickcolordialog.cpp b/src/imports/dialogs/qquickcolordialog.cpp
new file mode 100644
index 0000000000..39af99770e
--- /dev/null
+++ b/src/imports/dialogs/qquickcolordialog.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcolordialog_p.h"
+#include <QQuickItem>
+#include <private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype AbstractColorDialog
+ \instantiates QQuickColorDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \brief API wrapper for QML file dialog implementations
+ \since 5.1
+ \internal
+
+ AbstractColorDialog provides only the API for implementing a color dialog.
+ The implementation (e.g. a Window or preferably an Item, in case it is
+ shown on a device that doesn't support multiple windows) can be provided as
+ \l implementation, which is the default property (the only allowed child
+ element).
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractColorDialog::accepted
+
+ The \a accepted signal is emitted by \l accept().
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractColorDialog::rejected
+
+ The \a accepted signal is emitted by \l reject().
+*/
+
+/*!
+ \class QQuickColorDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ The QQuickColorDialog class is a concrete subclass of
+ \l QQuickAbstractColorDialog, but it is abstract from the QML perspective
+ because it needs to enclose a graphical implementation. It exists in order
+ to provide accessors and helper functions which the QML implementation will
+ need.
+
+ \since 5.1
+*/
+
+/*!
+ Constructs a file dialog wrapper with parent window \a parent.
+*/
+QQuickColorDialog::QQuickColorDialog(QObject *parent)
+ : QQuickAbstractColorDialog(parent)
+{
+}
+
+
+/*!
+ Destroys the file dialog wrapper.
+*/
+QQuickColorDialog::~QQuickColorDialog()
+{
+}
+
+/*!
+ \qmlproperty bool AbstractColorDialog::visible
+
+ This property holds whether the dialog is visible. By default this is false.
+*/
+
+/*!
+ \qmlproperty bool AbstractColorDialog::filePaths
+
+ A list of files to be populated as the user chooses.
+*/
+
+/*!
+ \qmlproperty QObject AbstractColorDialog::implementation
+
+ The QML object which implements the actual file dialog. Should be either a
+ \l Window or an \l Item.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickcolordialog_p.h b/src/imports/dialogs/qquickcolordialog_p.h
new file mode 100644
index 0000000000..ff6953fc0f
--- /dev/null
+++ b/src/imports/dialogs/qquickcolordialog_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCOLORDIALOG_P_H
+#define QQUICKCOLORDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractcolordialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickColorDialog : public QQuickAbstractColorDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
+ Q_CLASSINFO("DefaultProperty", "implementation") // AbstractColorDialog in QML can have only one child
+
+public:
+ explicit QQuickColorDialog(QObject *parent = 0);
+ ~QQuickColorDialog();
+
+protected:
+ virtual QPlatformColorDialogHelper *helper() { return 0; }
+
+ Q_DISABLE_COPY(QQuickColorDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickColorDialog *)
+
+#endif // QQUICKCOLORDIALOG_P_H
diff --git a/src/imports/dialogs/qquickplatformcolordialog.cpp b/src/imports/dialogs/qquickplatformcolordialog.cpp
new file mode 100644
index 0000000000..491a2e687c
--- /dev/null
+++ b/src/imports/dialogs/qquickplatformcolordialog.cpp
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickplatformcolordialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickView>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ColorDialog
+ \instantiates QQuickPlatformColorDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \brief Dialog component for choosing a color.
+ \since Qt 5.1
+
+ ColorDialog allows the user to select a color. The dialog is initially
+ invisible. You need to set the properties as desired first, then set
+ \l visible to true or call \l open().
+
+ Here is a minimal example to open a color dialog and exit after the user
+ chooses a color:
+
+ \qml
+ import QtQuick 2.1
+ import QtQuick.Dialogs 1.0
+
+ ColorDialog {
+ id: colorDialog
+ title: "Please choose a color"
+ onAccepted: {
+ console.log("You chose: " + colorDialog.color)
+ Qt.quit()
+ }
+ onRejected: {
+ console.log("Canceled")
+ Qt.quit()
+ }
+ Component.onCompleted: visible = true
+ }
+ \endqml
+
+ A ColorDialog window is automatically transient for its parent window. So
+ whether you declare the dialog inside an \l Item or inside a \l Window, the
+ dialog will appear centered over the window containing the item, or over
+ the Window that you declared.
+
+ The implementation of ColorDialog will be a platform color dialog if
+ possible. If that isn't possible, then it will try to instantiate a
+ \l QColorDialog. If that also isn't possible, then it will fall back to a QML
+ implementation, DefaultColorDialog.qml. In that case you can customize the
+ appearance by editing this file. DefaultColorDialog.qml contains a Rectangle
+ to hold the dialog's contents, because certain embedded systems do not
+ support multiple top-level windows. When the dialog becomes visible, it
+ will automatically be wrapped in a Window if possible, or simply reparented
+ on top of the main window if there can only be one window.
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::ColorDialog::accepted
+
+ The \a accepted signal is emitted when the user has finished using the
+ dialog. You can then inspect the \a color property to get the selection.
+
+ Example:
+
+ \qml
+ ColorDialog {
+ onAccepted: { console.log("Selected color: " + color) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::ColorDialog::rejected
+
+ The \a rejected signal is emitted when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickPlatformColorDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ \brief The QQuickPlatformColorDialog class provides a color dialog
+
+ The dialog is implemented via the QPlatformColorDialogHelper when possible;
+ otherwise it falls back to a QColorDialog or a QML implementation.
+
+ \since 5.1
+*/
+
+/*!
+ Constructs a color dialog with parent window \a parent.
+*/
+QQuickPlatformColorDialog::QQuickPlatformColorDialog(QObject *parent) :
+ QQuickAbstractColorDialog(parent)
+{
+}
+
+/*!
+ Destroys the color dialog.
+*/
+QQuickPlatformColorDialog::~QQuickPlatformColorDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformColorDialogHelper *QQuickPlatformColorDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
+ usePlatformNativeDialog(QPlatformTheme::ColorDialog) ) {
+ m_dlgHelper = static_cast<QPlatformColorDialogHelper *>(QGuiApplicationPrivate::platformTheme()
+ ->createPlatformDialogHelper(QPlatformTheme::ColorDialog));
+ if (!m_dlgHelper)
+ return m_dlgHelper;
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ connect(m_dlgHelper, SIGNAL(currentColorChanged(QColor)), this, SLOT(setColor(QColor)));
+ connect(m_dlgHelper, SIGNAL(colorSelected(QColor)), this, SLOT(setColor(QColor)));
+ }
+
+ return m_dlgHelper;
+}
+
+/*!
+ \qmlproperty bool ColorDialog::visible
+
+ This property holds whether the dialog is visible. By default this is
+ false.
+
+ \sa modality
+*/
+
+/*!
+ \qmlproperty Qt::WindowModality ColorDialog::modality
+
+ Whether the dialog should be shown modal with respect to the window
+ containing the dialog's parent Item, modal with respect to the whole
+ application, or non-modal.
+
+ By default it is \l NonModal.
+
+ Modality does not mean that there are any blocking calls to wait for the
+ dialog to be accepted or rejected; it's only that the user will be
+ prevented from interacting with the parent window and/or the application
+ windows at the same time.
+
+ On MacOS the color dialog is only allowed to be non-modal.
+*/
+
+/*!
+ \qmlmethod void ColorDialog::open()
+
+ Shows the dialog to the user. It is equivalent to setting \l visible to
+ true.
+*/
+
+/*!
+ \qmlmethod void ColorDialog::close()
+
+ Closes the dialog.
+*/
+
+/*!
+ \qmlproperty string ColorDialog::title
+
+ The title of the dialog window.
+*/
+
+/*!
+ \qmlproperty bool ColorDialog::showAlphaChannel
+
+ Whether the dialog will provide a means of changing the opacity.
+
+ By default, this property is true. This property must be set to the desired
+ value before opening the dialog. Usually the alpha channel is represented
+ by an additional slider control.
+*/
+
+/*!
+ \qmlproperty color ColorDialog::color
+
+ The color which the user selected.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickplatformcolordialog_p.h b/src/imports/dialogs/qquickplatformcolordialog_p.h
new file mode 100644
index 0000000000..55d301da8b
--- /dev/null
+++ b/src/imports/dialogs/qquickplatformcolordialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPLATFORMCOLORDIALOG_P_H
+#define QQUICKPLATFORMCOLORDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractcolordialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformColorDialog : public QQuickAbstractColorDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickPlatformColorDialog(QObject *parent = 0);
+ virtual ~QQuickPlatformColorDialog();
+
+protected:
+ QPlatformColorDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickPlatformColorDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformColorDialog *)
+
+#endif // QQUICKPLATFORMCOLORDIALOG_P_H