From 5ce41d1e77db3f46c396834f698826f4fd998344 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 11 Jun 2013 09:55:14 +0200 Subject: Clean up qt quick dialogs example again I5245a6931606673733130b1f168fddafe8def695 took us the wrong direction: the intention was to put ALL dialogs in one example, because each example has some overhead (project, docs, screenshot, c++ launcher) and we don't want to have several more separate examples after the other dialog types are added. Color and file dialogs have no relationship to each other except that they happened to be implemented first. This is analogous to qtbase/examples/widgets/dialogs/standarddialogs And in fact, each dialog type is in a separate qml file, so you can run them individually with qmlscene anyway, which will keep this from becoming unwieldy and hard to understand. Change-Id: Id28d5718b4b7b475dcd7d62e31c4634219dc3ddc Reviewed-by: Jerome Pasion Reviewed-by: Caroline Chao --- examples/quick/dialogs/ColorDialogs.qml | 145 ++++++++++++++++++ examples/quick/dialogs/FileDialogs.qml | 169 +++++++++++++++++++++ .../dialogs/colorandfiledialogs/ColorDialogs.qml | 145 ------------------ .../dialogs/colorandfiledialogs/FileDialogs.qml | 169 --------------------- .../colorandfiledialogs/colorandfiledialogs.pro | 17 --- .../colorandfiledialogs/colorandfiledialogs.qrc | 7 - .../quick/dialogs/colorandfiledialogs/dialogs.qml | 59 ------- .../doc/images/qml-colorandfiledialogs-example.jpg | Bin 47413 -> 0 bytes .../doc/src/colorandfiledialogs.qdoc | 44 ------ .../quick/dialogs/colorandfiledialogs/main.cpp | 41 ----- examples/quick/dialogs/dialogs.pro | 19 ++- examples/quick/dialogs/dialogs.qml | 59 +++++++ examples/quick/dialogs/dialogs.qrc | 7 + .../quick/dialogs/doc/images/dialogs-example.jpg | Bin 0 -> 47413 bytes examples/quick/dialogs/doc/src/dialogs.qdoc | 44 ++++++ examples/quick/dialogs/main.cpp | 41 +++++ 16 files changed, 481 insertions(+), 485 deletions(-) create mode 100644 examples/quick/dialogs/ColorDialogs.qml create mode 100644 examples/quick/dialogs/FileDialogs.qml delete mode 100644 examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml delete mode 100644 examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml delete mode 100644 examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro delete mode 100644 examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc delete mode 100644 examples/quick/dialogs/colorandfiledialogs/dialogs.qml delete mode 100644 examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg delete mode 100644 examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc delete mode 100644 examples/quick/dialogs/colorandfiledialogs/main.cpp create mode 100644 examples/quick/dialogs/dialogs.qml create mode 100644 examples/quick/dialogs/dialogs.qrc create mode 100644 examples/quick/dialogs/doc/images/dialogs-example.jpg create mode 100644 examples/quick/dialogs/doc/src/dialogs.qdoc create mode 100644 examples/quick/dialogs/main.cpp diff --git a/examples/quick/dialogs/ColorDialogs.qml b/examples/quick/dialogs/ColorDialogs.qml new file mode 100644 index 0000000000..6a0af7f730 --- /dev/null +++ b/examples/quick/dialogs/ColorDialogs.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** 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 +import QtQuick.Dialogs 1.0 +import "../shared" + +Rectangle { + width: 320 + height: 200 + color: palette.window + SystemPalette { id: palette } + clip: true + + //! [colordialog] + ColorDialog { + id: colorDialog + visible: colorDialogVisible.checked + modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: "Choose a color" + color: "green" + showAlphaChannel: colorDialogAlpha.checked + onAccepted: { console.log("Accepted: " + color) } + onRejected: { console.log("Rejected") } + } + //! [colordialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Text { + font.bold: true + text: "Color dialog properties:" + } + CheckBox { + id: colorDialogModal + text: "Modal" + checked: true + Binding on checked { value: colorDialog.modality != Qt.NonModal } + } + CheckBox { + id: colorDialogAlpha + text: "Show alpha channel" + Binding on checked { value: colorDialog.showAlphaChannel } + } + CheckBox { + id: colorDialogVisible + text: "Visible" + Binding on checked { value: colorDialog.visible } + } + Row { + id: colorRow + spacing: parent.spacing + height: colorLabel.implicitHeight * 2.0 + Rectangle { + color: colorDialog.color + height: parent.height + width: height * 2 + border.color: "black" + MouseArea { + anchors.fill: parent + onClicked: colorDialog.open() + } + } + Text { + id: colorLabel + color: palette.windowText + text: "current color: " + colorDialog.color + anchors.verticalCenter: parent.verticalCenter + } + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.close() + } + Button { + text: "set to green" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.color = "green" + } + } + } +} diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/FileDialogs.qml new file mode 100644 index 0000000000..d1278609f9 --- /dev/null +++ b/examples/quick/dialogs/FileDialogs.qml @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** 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 +import QtQuick.Dialogs 1.0 +import "../shared" + +Rectangle { + width: 580 + height: 400 + color: palette.window + SystemPalette { id: palette } + clip: true + + //! [filedialog] + FileDialog { + id: fileDialog + visible: fileDialogVisible.checked + modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: fileDialogSelectFolder.checked ? "Choose a folder" : + (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") + selectExisting: fileDialogSelectExisting.checked + selectMultiple: fileDialogSelectMultiple.checked + selectFolder: fileDialogSelectFolder.checked + nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] + selectedNameFilter: "All files (*)" + onAccepted: { console.log("Accepted: " + fileUrls) } + onRejected: { console.log("Rejected") } + } + //! [filedialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Text { + color: palette.windowText + font.bold: true + text: "File dialog properties:" + } + CheckBox { + id: fileDialogModal + text: "Modal" + checked: true + Binding on checked { value: fileDialog.modality != Qt.NonModal } + } + CheckBox { + id: fileDialogSelectFolder + text: "Select Folder" + Binding on checked { value: fileDialog.selectFolder } + } + CheckBox { + id: fileDialogSelectExisting + text: "Select Existing Files" + checked: true + Binding on checked { value: fileDialog.selectExisting } + } + CheckBox { + id: fileDialogSelectMultiple + text: "Select Multiple Files" + Binding on checked { value: fileDialog.selectMultiple } + } + CheckBox { + id: fileDialogVisible + text: "Visible" + Binding on checked { value: fileDialog.visible } + } + Text { + color: palette.windowText + text: "current view folder: " + fileDialog.folder + } + Text { + color: palette.windowText + text: "name filters: {" + fileDialog.nameFilters + "}" + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "current filter:" + fileDialog.selectedNameFilter + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "chosen files: " + fileDialog.fileUrls + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "chosen single path: " + fileDialog.fileUrl + width: parent.width + wrapMode: Text.Wrap + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.close() + } + Button { + text: "go to /tmp" + anchors.verticalCenter: parent.verticalCenter + // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. + onClicked: fileDialog.folder = "/tmp" + } + } + } +} diff --git a/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml b/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml deleted file mode 100644 index 6a0af7f730..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** 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 -import QtQuick.Dialogs 1.0 -import "../shared" - -Rectangle { - width: 320 - height: 200 - color: palette.window - SystemPalette { id: palette } - clip: true - - //! [colordialog] - ColorDialog { - id: colorDialog - visible: colorDialogVisible.checked - modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: "Choose a color" - color: "green" - showAlphaChannel: colorDialogAlpha.checked - onAccepted: { console.log("Accepted: " + color) } - onRejected: { console.log("Rejected") } - } - //! [colordialog] - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Text { - font.bold: true - text: "Color dialog properties:" - } - CheckBox { - id: colorDialogModal - text: "Modal" - checked: true - Binding on checked { value: colorDialog.modality != Qt.NonModal } - } - CheckBox { - id: colorDialogAlpha - text: "Show alpha channel" - Binding on checked { value: colorDialog.showAlphaChannel } - } - CheckBox { - id: colorDialogVisible - text: "Visible" - Binding on checked { value: colorDialog.visible } - } - Row { - id: colorRow - spacing: parent.spacing - height: colorLabel.implicitHeight * 2.0 - Rectangle { - color: colorDialog.color - height: parent.height - width: height * 2 - border.color: "black" - MouseArea { - anchors.fill: parent - onClicked: colorDialog.open() - } - } - Text { - id: colorLabel - color: palette.windowText - text: "current color: " + colorDialog.color - anchors.verticalCenter: parent.verticalCenter - } - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 50 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.close() - } - Button { - text: "set to green" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.color = "green" - } - } - } -} diff --git a/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml b/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml deleted file mode 100644 index d1278609f9..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** 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 -import QtQuick.Dialogs 1.0 -import "../shared" - -Rectangle { - width: 580 - height: 400 - color: palette.window - SystemPalette { id: palette } - clip: true - - //! [filedialog] - FileDialog { - id: fileDialog - visible: fileDialogVisible.checked - modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: fileDialogSelectFolder.checked ? "Choose a folder" : - (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") - selectExisting: fileDialogSelectExisting.checked - selectMultiple: fileDialogSelectMultiple.checked - selectFolder: fileDialogSelectFolder.checked - nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] - selectedNameFilter: "All files (*)" - onAccepted: { console.log("Accepted: " + fileUrls) } - onRejected: { console.log("Rejected") } - } - //! [filedialog] - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Text { - color: palette.windowText - font.bold: true - text: "File dialog properties:" - } - CheckBox { - id: fileDialogModal - text: "Modal" - checked: true - Binding on checked { value: fileDialog.modality != Qt.NonModal } - } - CheckBox { - id: fileDialogSelectFolder - text: "Select Folder" - Binding on checked { value: fileDialog.selectFolder } - } - CheckBox { - id: fileDialogSelectExisting - text: "Select Existing Files" - checked: true - Binding on checked { value: fileDialog.selectExisting } - } - CheckBox { - id: fileDialogSelectMultiple - text: "Select Multiple Files" - Binding on checked { value: fileDialog.selectMultiple } - } - CheckBox { - id: fileDialogVisible - text: "Visible" - Binding on checked { value: fileDialog.visible } - } - Text { - color: palette.windowText - text: "current view folder: " + fileDialog.folder - } - Text { - color: palette.windowText - text: "name filters: {" + fileDialog.nameFilters + "}" - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "current filter:" + fileDialog.selectedNameFilter - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "chosen files: " + fileDialog.fileUrls - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "chosen single path: " + fileDialog.fileUrl - width: parent.width - wrapMode: Text.Wrap - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 50 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.close() - } - Button { - text: "go to /tmp" - anchors.verticalCenter: parent.verticalCenter - // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. - onClicked: fileDialog.folder = "/tmp" - } - } - } -} diff --git a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro deleted file mode 100644 index 3a7b25c91a..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp -RESOURCES += colorandfiledialogs.qrc ../../shared/shared.qrc - -OTHER_FILES += \ - dialogs.qml \ - FileDialogs.qml \ - ColorDialogs.qml - -EXAMPLE_FILES = \ - FileDialogs.qml \ - ColorDialogs.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs -INSTALLS += target diff --git a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc deleted file mode 100644 index efebfe4845..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - dialogs.qml - FileDialogs.qml - ColorDialogs.qml - - diff --git a/examples/quick/dialogs/colorandfiledialogs/dialogs.qml b/examples/quick/dialogs/colorandfiledialogs/dialogs.qml deleted file mode 100644 index b5f9841a3f..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/dialogs.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** 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 -import "../shared" - -TabSet { - width: 580 - height: 440 - - FileDialogs { - property string title: "File Dialog" - anchors.fill: parent - color: "#e3e3e3" // to match tab.png - } - - ColorDialogs { - property string title: "Color Dialog" - anchors.fill: parent - color: "#e3e3e3" // to match tab.png - } -} diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg b/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg deleted file mode 100644 index 4517a39308..0000000000 Binary files a/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg and /dev/null differ diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc b/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc deleted file mode 100644 index 68804649a9..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 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 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$ -** -****************************************************************************/ -/*! - \title Qt Quick ColorDialog and FileDialog Examples - \example colorandfiledialogs - \brief This example demonstrates the color and file dialog types in QML - \image qml-colorandfiledialogs-example.jpg - \ingroup qtquickdialog_examples - - This example demonstrates the color and file system dialogs in the \l{Qt Quick Dialogs} - module. The appearance and behavior is platform-dependent. - - A \l FileDialog is used to choose a single file, multiple files or a - single directory, depending on how it is configured. - \snippet colorandfiledialogs/FileDialogs.qml filedialog - - A \l ColorDialog is used to choose a color, with or without alpha (transparency) - depending on how it is configured. - \snippet colorandfiledialogs/ColorDialogs.qml colordialog -*/ diff --git a/examples/quick/dialogs/colorandfiledialogs/main.cpp b/examples/quick/dialogs/colorandfiledialogs/main.cpp deleted file mode 100644 index e8c2ae6aaa..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro index 275e36470f..b76f396e9d 100644 --- a/examples/quick/dialogs/dialogs.pro +++ b/examples/quick/dialogs/dialogs.pro @@ -1,4 +1,17 @@ -TEMPLATE = subdirs +TEMPLATE = app -SUBDIRS = \ - colorandfiledialogs +QT += quick qml +SOURCES += main.cpp +RESOURCES += dialogs.qrc ../shared/shared.qrc + +OTHER_FILES += \ + dialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml + +EXAMPLE_FILES = \ + FileDialogs.qml \ + ColorDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs +INSTALLS += target diff --git a/examples/quick/dialogs/dialogs.qml b/examples/quick/dialogs/dialogs.qml new file mode 100644 index 0000000000..b5f9841a3f --- /dev/null +++ b/examples/quick/dialogs/dialogs.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** 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 +import "../shared" + +TabSet { + width: 580 + height: 440 + + FileDialogs { + property string title: "File Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } + + ColorDialogs { + property string title: "Color Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } +} diff --git a/examples/quick/dialogs/dialogs.qrc b/examples/quick/dialogs/dialogs.qrc new file mode 100644 index 0000000000..efebfe4845 --- /dev/null +++ b/examples/quick/dialogs/dialogs.qrc @@ -0,0 +1,7 @@ + + + dialogs.qml + FileDialogs.qml + ColorDialogs.qml + + diff --git a/examples/quick/dialogs/doc/images/dialogs-example.jpg b/examples/quick/dialogs/doc/images/dialogs-example.jpg new file mode 100644 index 0000000000..4517a39308 Binary files /dev/null and b/examples/quick/dialogs/doc/images/dialogs-example.jpg differ diff --git a/examples/quick/dialogs/doc/src/dialogs.qdoc b/examples/quick/dialogs/doc/src/dialogs.qdoc new file mode 100644 index 0000000000..daac914c60 --- /dev/null +++ b/examples/quick/dialogs/doc/src/dialogs.qdoc @@ -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 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 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 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$ +** +****************************************************************************/ +/*! + \title Qt Quick Dialog Examples + \example dialogs + \brief This example demonstrates the dialog types in QML + \image dialogs-example.jpg + \ingroup qtquickdialog_examples + + This example demonstrates the system dialogs in the \l{Qt Quick Dialogs} + module. The appearance and behavior is platform-dependent. + + A \l FileDialog is used to choose a single file, multiple files or a + single directory, depending on how it is configured. + \snippet dialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet dialogs/ColorDialogs.qml colordialog +*/ diff --git a/examples/quick/dialogs/main.cpp b/examples/quick/dialogs/main.cpp new file mode 100644 index 0000000000..bbf0c48104 --- /dev/null +++ b/examples/quick/dialogs/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#include "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) -- cgit v1.2.3