diff options
Diffstat (limited to 'examples/quickcontrols/dialogs')
12 files changed, 1434 insertions, 0 deletions
diff --git a/examples/quickcontrols/dialogs/dialogs.pro b/examples/quickcontrols/dialogs/dialogs.pro new file mode 100644 index 000000000..538e75686 --- /dev/null +++ b/examples/quickcontrols/dialogs/dialogs.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS = \ + systemdialogs diff --git a/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml new file mode 100644 index 000000000..60db0d0f9 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.1 + +Item { + width: 320 + height: 240 + 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 + Label { + 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() + } + } + Label { + id: colorLabel + text: "<b>current color:</b> " + colorDialog.color + anchors.verticalCenter: parent.verticalCenter + } + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: implicitHeight + 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/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml new file mode 100644 index 000000000..c99ed9deb --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml @@ -0,0 +1,349 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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.3 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Item { + id: root + width: 580 + height: 400 + SystemPalette { id: palette } + clip: true + + //! [dialog] + Dialog { + id: helloDialog + modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: customizeTitle.checked ? windowTitleField.text : "Hello" + onButtonClicked: console.log("clicked button " + clickedButton) + onAccepted: lastChosen.text = "Accepted " + + (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)")) + onRejected: lastChosen.text = "Rejected " + + (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)")) + onHelp: lastChosen.text = "Yelped for help!" + onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always") + onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!") + onApply: lastChosen.text = "Apply" + onReset: lastChosen.text = "Reset" + + Label { + text: "Hello world!" + } + } + //! [dialog] + + Dialog { + id: spinboxDialog + modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: customizeTitle.checked ? windowTitleField.text : "Spinbox" + onHelp: { + lastChosen.text = "No help available, sorry. Please answer the question." + visible = true + } + onButtonClicked: { + if (clickedButton === StandardButton.Ok && answer.value == 11.0) + lastChosen.text = "You are correct!" + else + lastChosen.text = "Having failed to give the correct answer, you shall not pass!" + } + + ColumnLayout { + id: column + width: parent ? parent.width : 100 + Label { + text: "<b>What</b> is the average airspeed velocity of an unladen European swallow?" + Layout.columnSpan: 2 + Layout.fillWidth: true + wrapMode: Text.WordWrap + } + RowLayout { + Layout.alignment: Qt.AlignHCenter + SpinBox { + id: answer + onEditingFinished: spinboxDialog.click(StandardButton.Ok) + } + Label { + text: "m/s" + Layout.alignment: Qt.AlignBaseline | Qt.AlignLeft + } + } + } + } + + Dialog { + id: dateDialog + modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: customizeTitle.checked ? windowTitleField.text : "Choose a date" + onButtonClicked: console.log("clicked button " + clickedButton) + onAccepted: { + if (clickedButton == StandardButton.Ok) + lastChosen.text = "Accepted " + calendar.selectedDate.toLocaleDateString() + else + lastChosen.text = (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)") + } + onRejected: lastChosen.text = "Rejected" + + Calendar { + id: calendar + width: parent ? parent.width : implicitWidth + onDoubleClicked: dateDialog.click(StandardButton.Ok) + } + } + + Dialog { + id: filledDialog + modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: customizeTitle.checked ? windowTitleField.text : "Customized content" + onRejected: lastChosen.text = "Rejected" + onAccepted: lastChosen.text = "Accepted " + + (clickedButton === StandardButton.Retry ? "(Retry)" : "(OK)") + onButtonClicked: if (clickedButton === StandardButton.Retry) lastChosen.text = "Retry" + contentItem: Rectangle { + color: "lightskyblue" + implicitWidth: 400 + implicitHeight: 100 + Label { + text: "Hello blue sky!" + color: "navy" + anchors.centerIn: parent + } + Keys.onPressed: if (event.key === Qt.Key_R && (event.modifiers & Qt.ControlModifier)) filledDialog.click(StandardButton.Retry) + Keys.onEnterPressed: filledDialog.accept() + Keys.onEscapePressed: filledDialog.reject() + Keys.onBackPressed: filledDialog.reject() // especially necessary on Android + } + } + + ColumnLayout { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Label { + font.bold: true + text: "Message dialog properties:" + } + CheckBox { + id: dialogModal + text: "Modal" + Binding on checked { value: helloDialog.modality != Qt.NonModal } + } + RowLayout { + CheckBox { + id: customizeTitle + text: "Window Title" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: windowTitleField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "Custom Dialog" + } + } + Label { + text: "Buttons:" + } + Flow { + spacing: 8 + Layout.fillWidth: true + property bool updating: false + function updateButtons(button, checked) { + if (updating) return + updating = true + var buttons = 0 + for (var i = 0; i < children.length; ++i) + if (children[i].checked) + buttons |= children[i].button + if (!buttons) + buttons = StandardButton.Ok + helloDialog.standardButtons = buttons + spinboxDialog.standardButtons = buttons + dateDialog.standardButtons = buttons + updating = false + } + + CheckBox { + text: "Help" + property int button: StandardButton.Help + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Abort" + property int button: StandardButton.Abort + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Close" + property int button: StandardButton.Close + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Cancel" + property int button: StandardButton.Cancel + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "NoToAll" + property int button: StandardButton.NoToAll + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "No" + property int button: StandardButton.No + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "YesToAll" + property int button: StandardButton.YesToAll + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Yes" + property int button: StandardButton.Yes + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Ignore" + property int button: StandardButton.Ignore + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Retry" + property int button: StandardButton.Retry + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Apply" + property int button: StandardButton.Apply + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Reset" + property int button: StandardButton.Reset + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Restore Defaults" + property int button: StandardButton.RestoreDefaults + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "OK" + checked: true + property int button: StandardButton.Ok + onCheckedChanged: parent.updateButtons(button, checked) + } + + Component.onCompleted: updateButtons() + } + Label { + id: lastChosen + } + Item { Layout.fillHeight: true } + } + + Rectangle { + id: bottomBar + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + width: parent.width + Button { + text: "Hello World" + anchors.verticalCenter: parent.verticalCenter + onClicked: helloDialog.open() + } + Button { + text: "Input" + anchors.verticalCenter: parent.verticalCenter + onClicked: spinboxDialog.open() + } + Button { + text: "Date" + anchors.verticalCenter: parent.verticalCenter + onClicked: dateDialog.open() + } + Button { + text: "No buttons or margins" + anchors.verticalCenter: parent.verticalCenter + onClicked: filledDialog.open() + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml new file mode 100644 index 000000000..ad18cb577 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Item { + width: 580 + height: 400 + 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 (*)" + sidebarVisible: fileDialogSidebarVisible.checked + onAccepted: { + console.log("Accepted: " + fileUrls) + if (fileDialogOpenFiles.checked) + for (var i = 0; i < fileUrls.length; ++i) + Qt.openUrlExternally(fileUrls[i]) + } + onRejected: { console.log("Rejected") } + } + //! [filedialog] + + ScrollView { + id: scrollView + anchors { + left: parent.left + right: parent.right + top: parent.top + bottom: bottomBar.top + leftMargin: 12 + } + ColumnLayout { + spacing: 8 + Item { Layout.preferredHeight: 4 } // padding + Label { + 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: fileDialogOpenFiles + text: "Open Files After Accepting" + } + CheckBox { + id: fileDialogSidebarVisible + text: "Show Sidebar" + checked: fileDialog.sidebarVisible + Binding on checked { value: fileDialog.sidebarVisible } + } + CheckBox { + id: fileDialogVisible + text: "Visible" + Binding on checked { value: fileDialog.visible } + } + Label { + text: "<b>current view folder:</b> " + fileDialog.folder + } + Label { + text: "<b>name filters:</b> {" + fileDialog.nameFilters + "}" + } + Label { + text: "<b>current filter:</b>" + fileDialog.selectedNameFilter + } + Label { + text: "<b>chosen files:</b> " + fileDialog.fileUrls + } + Label { + text: "<b>chosen single path:</b> " + fileDialog.fileUrl + } + } + } + + Rectangle { + id: bottomBar + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: implicitHeight + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Pictures" + tooltip: "go to my Pictures directory" + anchors.verticalCenter: parent.verticalCenter + enabled: fileDialog.shortcuts.hasOwnProperty("pictures") + onClicked: fileDialog.folder = fileDialog.shortcuts.pictures + } + Button { + text: "Home" + tooltip: "go to my home directory" + anchors.verticalCenter: parent.verticalCenter + enabled: fileDialog.shortcuts.hasOwnProperty("home") + onClicked: fileDialog.folder = fileDialog.shortcuts.home + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml new file mode 100644 index 000000000..91c20de24 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.1 + +Item { + width: 320 + height: 360 + SystemPalette { id: palette } + clip: true + + FontDialog { + id: fontDialog + visible: fontDialogVisible.checked + modality: fontDialogModal.checked ? Qt.WindowModal : Qt.NonModal + scalableFonts: fontDialogScalableFonts.checked + nonScalableFonts: fontDialogNonScalableFonts.checked + monospacedFonts: fontDialogMonospacedFonts.checked + proportionalFonts: fontDialogProportionalFonts.checked + title: "Choose a font" + font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) + currentFont: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) + onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) } + onAccepted: { console.log("Accepted: " + font) } + onRejected: { console.log("Rejected") } + } + + Column { + id: optionsColumn + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Label { + font.bold: true + text: "Font dialog properties:" + } + CheckBox { + id: fontDialogModal + text: "Modal" + checked: true + Binding on checked { value: fontDialog.modality != Qt.NonModal } + } + CheckBox { + id: fontDialogScalableFonts + text: "Scalable fonts" + Binding on checked { value: fontDialog.scalableFonts } + } + CheckBox { + id: fontDialogNonScalableFonts + text: "Non scalable fonts" + Binding on checked { value: fontDialog.nonScalableFonts } + } + CheckBox { + id: fontDialogMonospacedFonts + text: "Monospaced fonts" + Binding on checked { value: fontDialog.monospacedFonts } + } + CheckBox { + id: fontDialogProportionalFonts + text: "Proportional fonts" + Binding on checked { value: fontDialog.proportionalFonts } + } + CheckBox { + id: fontDialogVisible + text: "Visible" + Binding on checked { value: fontDialog.visible } + } + Label { + text: "Current font:" + } + Label { + id: fontLabel + text: "<b>" + fontDialog.font.family + " - " + fontDialog.font.pointSize + "</b>" + MouseArea { + anchors.fill: parent + onClicked: fontDialog.open() + } + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fontDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fontDialog.close() + } + Button { + text: "set to default" + anchors.verticalCenter: parent.verticalCenter + onClicked: fontDialog.font = Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml new file mode 100644 index 000000000..b9b507c72 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml @@ -0,0 +1,336 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Item { + id: root + width: 580 + height: 400 + SystemPalette { id: palette } + clip: true + + //! [messagedialog] + MessageDialog { + id: messageDialog + visible: messageDialogVisible.checked + modality: messageDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: windowTitleField.text + text: customizeText.checked ? textField.text : "" + informativeText: customizeInformativeText.checked ? informativeTextField.text : "" + detailedText: customizeDetailedText.checked ? detailedTextField.text : "" + onButtonClicked: console.log("clicked button " + clickedButton) + onAccepted: lastChosen.text = "Accepted " + + (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)")) + onRejected: lastChosen.text = "Rejected " + + (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)")) + onHelp: lastChosen.text = "Yelped for help!" + onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always") + onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!") + onApply: lastChosen.text = "Apply" + onReset: lastChosen.text = "Reset" + } + //! [messagedialog] + + ScrollView { + id: scrollView + anchors { + left: parent.left + right: parent.right + top: parent.top + bottom: bottomBar.top + leftMargin: 12 + } + ColumnLayout { + spacing: 8 + Item { Layout.preferredHeight: 4 } // padding + Label { + font.bold: true + text: "Message dialog properties:" + } + CheckBox { + id: messageDialogModal + text: "Modal" + checked: true + Binding on checked { value: messageDialog.modality != Qt.NonModal } + } + RowLayout { + CheckBox { + id: customizeTitle + text: "Window Title" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: windowTitleField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "Alert" + } + } + Label { text: "Icon:" } + Flow { + spacing: 8 + Layout.fillWidth: true + property bool updating: false + function updateIcon(icon, checked) { + if (updating) return + updating = true + messageDialog.icon = (checked ? icon : StandardIcon.NoIcon) + for (var i = 0; i < children.length; ++i) + if (children[i].icon !== icon) + children[i].checked = false + updating = false + } + + CheckBox { + id: iconInformation + text: "Information" + property int icon: StandardIcon.Information + onCheckedChanged: parent.updateIcon(icon, checked) + } + + CheckBox { + id: iconWarning + text: "Warning" + checked: true + property int icon: StandardIcon.Warning + onCheckedChanged: parent.updateIcon(icon, checked) + Component.onCompleted: parent.updateIcon(icon, true) + } + + CheckBox { + id: iconCritical + text: "Critical" + property int icon: StandardIcon.Critical + onCheckedChanged: parent.updateIcon(icon, checked) + } + + CheckBox { + id: iconQuestion + text: "Question" + property int icon: StandardIcon.Question + onCheckedChanged: parent.updateIcon(icon, checked) + } + } + + RowLayout { + CheckBox { + id: customizeText + text: "Primary Text" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: textField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "Attention Please" + } + } + RowLayout { + CheckBox { + id: customizeInformativeText + text: "Informative Text" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: informativeTextField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "Be alert!" + } + } + Label { text: "Buttons:" } + Flow { + spacing: 8 + Layout.fillWidth: true + Layout.preferredWidth: root.width - 30 + property bool updating: false + function updateButtons(button, checked) { + if (updating) return + updating = true + var buttons = 0 + for (var i = 0; i < children.length; ++i) + if (children[i].checked) + buttons |= children[i].button + if (!buttons) + buttons = StandardButton.Ok + messageDialog.standardButtons = buttons + updating = false + } + + CheckBox { + text: "Help" + property int button: StandardButton.Help + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Abort" + property int button: StandardButton.Abort + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Close" + property int button: StandardButton.Close + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Cancel" + property int button: StandardButton.Cancel + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "NoToAll" + property int button: StandardButton.NoToAll + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "No" + property int button: StandardButton.No + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "YesToAll" + property int button: StandardButton.YesToAll + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Yes" + property int button: StandardButton.Yes + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Ignore" + property int button: StandardButton.Ignore + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Retry" + property int button: StandardButton.Retry + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "OK" + checked: true + property int button: StandardButton.Ok + onCheckedChanged: parent.updateButtons(button, checked) + } + } + RowLayout { + CheckBox { + id: customizeDetailedText + text: "Detailed Text" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: detailedTextField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "The world needs more lerts." + } + } + CheckBox { + id: messageDialogVisible + text: "Visible" + Binding on checked { value: messageDialog.visible } + } + Label { + id: lastChosen + } + } + } + + Rectangle { + id: bottomBar + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: messageDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: messageDialog.close() + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg b/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg Binary files differnew file mode 100644 index 000000000..4517a3930 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg diff --git a/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc b/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc new file mode 100644 index 000000000..1912a906c --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick System Dialog Examples + \example systemdialogs + \brief This example demonstrates the system dialog types in QML + \image systemdialogs-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 systemdialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet systemdialogs/ColorDialogs.qml colordialog + + The example can be built as a standalone executable, but each + type of dialog is demonstrated in a separate QML file which can + also be run separately with qmlscene. +*/ diff --git a/examples/quickcontrols/dialogs/systemdialogs/main.cpp b/examples/quickcontrols/dialogs/systemdialogs/main.cpp new file mode 100644 index 000000000..f16109d65 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/main.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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 "qtquickcontrolsapplication.h" +#include <QtQml/QQmlApplicationEngine> +#include <QtGui/QSurfaceFormat> +#include <QtQuick/QQuickWindow> + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { + QSurfaceFormat fmt; + fmt.setVersion(4, 4); + fmt.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(fmt); + } + QQmlApplicationEngine engine(QUrl("qrc:/dialogs/systemdialogs/systemdialogs.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro new file mode 100644 index 000000000..099e3773f --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro @@ -0,0 +1,19 @@ +QT += qml quick +!no_desktop: QT += widgets + +QT += quick qml +SOURCES += main.cpp +include(../../controls/shared/shared.pri) + +OTHER_FILES += \ + systemdialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml \ + FontDialogs.qml \ + MessageDialogs.qml \ + CustomDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/dialogs/systemdialogs +INSTALLS += target + +RESOURCES += systemdialogs.qrc diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml new file mode 100644 index 000000000..5971e1c88 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, 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 The Qt Company Ltd 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.2 +import QtQuick.Controls 1.2 + +ApplicationWindow { + visible: true + title: "System Dialogs Gallery" + width: 580 + height: 480 + + TabView { + anchors.fill: parent + anchors.margins: 8 + Tab { + id: controlPage + title: "File" + FileDialogs { } + } + Tab { + title: "Color" + ColorDialogs { } + } + Tab { + title: "Font" + FontDialogs { anchors.fill: parent } + } + Tab { + title: "Message" + MessageDialogs { anchors.fill:parent } + } + Tab { + title: "Custom" + CustomDialogs { anchors.fill:parent } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc new file mode 100644 index 000000000..afd81bfee --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc @@ -0,0 +1,10 @@ +<RCC> + <qresource prefix="/dialogs/systemdialogs"> + <file>systemdialogs.qml</file> + <file>FileDialogs.qml</file> + <file>ColorDialogs.qml</file> + <file>FontDialogs.qml</file> + <file>MessageDialogs.qml</file> + <file>CustomDialogs.qml</file> + </qresource> +</RCC> |