Adding QtQuick.Dialogs.MessageDialog
Change-Id: Ifa3de21e6f611c24742118d6d178edbe14f243be Reviewed-by: Liang Qi <liang.qi@digia.com>
This commit is contained in:
parent
607f2db351
commit
a25b1fdf7d
|
@ -0,0 +1,307 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** 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.1
|
||||
import QtQuick.Dialogs 1.1
|
||||
import QtQuick.Window 2.0
|
||||
import "../../shared"
|
||||
|
||||
Rectangle {
|
||||
width: 580
|
||||
height: 400
|
||||
color: palette.window
|
||||
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 == Message.Ok ? "(OK)" : (clickedButton == Message.Retry ? "(Retry)" : "(Ignore)"))
|
||||
onRejected: lastChosen.text = "Rejected " +
|
||||
(clickedButton == Message.Close ? "(Close)" : (clickedButton == Message.Abort ? "(Abort)" : "(Cancel)"))
|
||||
onHelp: lastChosen.text = "Yelped for help!"
|
||||
onYes: lastChosen.text = (clickedButton == Message.Yes ? "Yeessss!!" : "Yes, now and always")
|
||||
onNo: lastChosen.text = (clickedButton == Message.No ? "Oh No." : "No, no, a thousand times no!")
|
||||
onApply: lastChosen.text = "Apply"
|
||||
onReset: lastChosen.text = "Reset"
|
||||
}
|
||||
//! [messagedialog]
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
spacing: 8
|
||||
Text {
|
||||
color: palette.windowText
|
||||
font.bold: true
|
||||
text: "Message dialog properties:"
|
||||
}
|
||||
CheckBox {
|
||||
id: messageDialogModal
|
||||
text: "Modal"
|
||||
checked: true
|
||||
Binding on checked { value: messageDialog.modality != Qt.NonModal }
|
||||
}
|
||||
CheckBox {
|
||||
id: customizeTitle
|
||||
text: "Window Title"
|
||||
checked: true
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: windowTitleField
|
||||
anchors.right: parent.right
|
||||
width: informativeTextField.width
|
||||
text: "Alert"
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 8
|
||||
property bool updating: false
|
||||
function updateIcon(icon, checked) {
|
||||
if (updating) return
|
||||
updating = true
|
||||
messageDialog.icon = (checked ? icon : Message.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: Message.Information
|
||||
onCheckedChanged: parent.updateIcon(icon, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: iconWarning
|
||||
text: "Warning"
|
||||
checked: true
|
||||
property int icon: Message.Warning
|
||||
onCheckedChanged: parent.updateIcon(icon, checked)
|
||||
Component.onCompleted: parent.updateIcon(icon, true)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: iconCritical
|
||||
text: "Critical"
|
||||
property int icon: Message.Critical
|
||||
onCheckedChanged: parent.updateIcon(icon, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: iconQuestion
|
||||
text: "Question"
|
||||
property int icon: Message.Question
|
||||
onCheckedChanged: parent.updateIcon(icon, checked)
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: customizeText
|
||||
text: "Primary Text"
|
||||
checked: true
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: textField
|
||||
anchors.right: parent.right
|
||||
width: informativeTextField.width
|
||||
text: "Attention Please"
|
||||
}
|
||||
}
|
||||
CheckBox {
|
||||
id: customizeInformativeText
|
||||
text: "Informative Text"
|
||||
checked: true
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: informativeTextField
|
||||
anchors.right: parent.right
|
||||
width: parent.width - parent.row.spacing - parent.row.width
|
||||
text: "Be alert!"
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: "Buttons:"
|
||||
}
|
||||
Flow {
|
||||
spacing: 8
|
||||
width: parent.width
|
||||
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 = Message.Ok
|
||||
messageDialog.standardButtons = buttons
|
||||
updating = false
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "Help"
|
||||
property int button: Message.Help
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "Abort"
|
||||
property int button: Message.Abort
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "Close"
|
||||
property int button: Message.Close
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "Cancel"
|
||||
property int button: Message.Cancel
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "NoToAll"
|
||||
property int button: Message.NoToAll
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "No"
|
||||
property int button: Message.No
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "YesToAll"
|
||||
property int button: Message.YesToAll
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "Yes"
|
||||
property int button: Message.Yes
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "Ignore"
|
||||
property int button: Message.Ignore
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "Retry"
|
||||
property int button: Message.Retry
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: "OK"
|
||||
checked: true
|
||||
property int button: Message.Ok
|
||||
onCheckedChanged: parent.updateButtons(button, checked)
|
||||
}
|
||||
}
|
||||
CheckBox {
|
||||
id: customizeDetailedText
|
||||
text: "Detailed Text"
|
||||
checked: true
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: detailedTextField
|
||||
anchors.right: parent.right
|
||||
width: informativeTextField.width
|
||||
text: "The world needs more lerts."
|
||||
}
|
||||
}
|
||||
CheckBox {
|
||||
id: messageDialogVisible
|
||||
text: "Visible"
|
||||
Binding on checked { value: messageDialog.visible }
|
||||
}
|
||||
Text {
|
||||
id: lastChosen
|
||||
}
|
||||
}
|
||||
|
||||
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: messageDialog.open()
|
||||
}
|
||||
Button {
|
||||
text: "Close"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: messageDialog.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,8 @@ OTHER_FILES += \
|
|||
systemdialogs.qml \
|
||||
FileDialogs.qml \
|
||||
ColorDialogs.qml \
|
||||
FontDialogs.qml
|
||||
FontDialogs.qml \
|
||||
MessageDialogs.qml
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs/systemdialogs
|
||||
INSTALLS += target
|
||||
|
|
|
@ -62,4 +62,10 @@ TabSet {
|
|||
anchors.fill: parent
|
||||
color: "#e3e3e3" // to match tab.png
|
||||
}
|
||||
|
||||
MessageDialogs {
|
||||
property string title: "Message Dialog"
|
||||
anchors.fill: parent
|
||||
color: "#e3e3e3" // to match tab.png
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
<file>FileDialogs.qml</file>
|
||||
<file>ColorDialogs.qml</file>
|
||||
<file>FontDialogs.qml</file>
|
||||
<file>MessageDialogs.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -49,6 +49,7 @@ Item {
|
|||
property alias text: label.text
|
||||
property bool checked
|
||||
property alias pressed: mouseArea.pressed
|
||||
property alias row: row
|
||||
signal clicked
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
|
|
@ -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: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: root
|
||||
|
||||
property alias textInput: textInput
|
||||
property alias text: textInput.text
|
||||
signal accepted
|
||||
signal downPressed
|
||||
implicitWidth: textInput.implicitWidth + rect.radius * 2
|
||||
implicitHeight: textInput.implicitHeight
|
||||
|
||||
function copyAll() {
|
||||
textInput.selectAll()
|
||||
textInput.copy()
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
height: textInput.implicitHeight + 8
|
||||
clip: true
|
||||
|
||||
Rectangle {
|
||||
id: rect
|
||||
anchors.fill: parent
|
||||
radius: height / 4
|
||||
color: palette.button
|
||||
border.color: Qt.darker(palette.button, 1.5)
|
||||
}
|
||||
|
||||
TextInput {
|
||||
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()
|
||||
}
|
||||
}
|
|
@ -4,3 +4,4 @@ LauncherList 2.0 LauncherList.qml
|
|||
SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml
|
||||
Slider 2.0 Slider.qml
|
||||
TabSet 2.1 TabSet.qml
|
||||
TextField 2.1 TextField.qml
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<file>SimpleLauncherDelegate.qml</file>
|
||||
<file>Button.qml</file>
|
||||
<file>CheckBox.qml</file>
|
||||
<file>TextField.qml</file>
|
||||
<file>images/back.png</file>
|
||||
<file>images/next.png</file>
|
||||
</qresource>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<file>images/slider_handle.png</file>
|
||||
<file>CheckBox.qml</file>
|
||||
<file>TabSet.qml</file>
|
||||
<file>TextField.qml</file>
|
||||
<file>images/back.png</file>
|
||||
<file>images/next.png</file>
|
||||
<file>images/qt-logo.png</file>
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
/*****************************************************************************
|
||||
**
|
||||
** 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.Window 2.1
|
||||
import QtQuick.Dialogs 1.1
|
||||
import "qml"
|
||||
|
||||
AbstractMessageDialog {
|
||||
id: root
|
||||
|
||||
Rectangle {
|
||||
id: content
|
||||
property real spacing: 8
|
||||
property real outerSpacing: 12
|
||||
property int maxSize: 0.9 * Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight)
|
||||
implicitHeight: contentColumn.implicitHeight + outerSpacing * 2
|
||||
onImplicitHeightChanged: root.height = implicitHeight
|
||||
implicitWidth: Math.min(maxSize, Math.max(
|
||||
mainText.implicitWidth, buttons.implicitWidth) + outerSpacing * 2);
|
||||
onImplicitWidthChanged: if (implicitWidth > root.width) root.width = implicitWidth
|
||||
color: palette.window
|
||||
focus: true
|
||||
Keys.onEscapePressed: root.reject()
|
||||
Keys.onEnterPressed: root.accept()
|
||||
Keys.onReturnPressed: root.accept()
|
||||
Keys.onPressed: if (event.modifiers === Qt.ControlModifier)
|
||||
switch (event.key) {
|
||||
case Qt.Key_A:
|
||||
detailedText.selectAll();
|
||||
break;
|
||||
case Qt.Key_C:
|
||||
detailedText.copy();
|
||||
break;
|
||||
}
|
||||
|
||||
Column {
|
||||
id: contentColumn
|
||||
spacing: content.spacing
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: content.outerSpacing
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Math.max(icon.height, mainText.height + informativeText.height + content.spacing)
|
||||
Image {
|
||||
id: icon
|
||||
source: root.standardIconSource
|
||||
}
|
||||
|
||||
Text {
|
||||
id: mainText
|
||||
anchors {
|
||||
left: icon.right
|
||||
leftMargin: content.spacing
|
||||
right: parent.right
|
||||
}
|
||||
text: root.text
|
||||
font.weight: Font.Bold
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Text {
|
||||
id: informativeText
|
||||
anchors {
|
||||
left: icon.right
|
||||
right: parent.right
|
||||
top: mainText.bottom
|
||||
leftMargin: content.spacing
|
||||
topMargin: content.spacing
|
||||
}
|
||||
text: root.informativeText
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row {
|
||||
id: buttons
|
||||
spacing: content.spacing
|
||||
layoutDirection: Qt.RightToLeft
|
||||
width: parent.width
|
||||
Button {
|
||||
id: okButton
|
||||
text: "OK"
|
||||
onClicked: root.click(Message.Ok)
|
||||
visible: root.standardButtons & Message.Ok
|
||||
}
|
||||
Button {
|
||||
id: openButton
|
||||
text: "Open"
|
||||
onClicked: root.click(Message.Open)
|
||||
visible: root.standardButtons & Message.Open
|
||||
}
|
||||
Button {
|
||||
id: saveButton
|
||||
text: "Save"
|
||||
onClicked: root.click(Message.Save)
|
||||
visible: root.standardButtons & Message.Save
|
||||
}
|
||||
Button {
|
||||
id: saveAllButton
|
||||
text: "Save All"
|
||||
onClicked: root.click(Message.SaveAll)
|
||||
visible: root.standardButtons & Message.SaveAll
|
||||
}
|
||||
Button {
|
||||
id: retryButton
|
||||
text: "Retry"
|
||||
onClicked: root.click(Message.Retry)
|
||||
visible: root.standardButtons & Message.Retry
|
||||
}
|
||||
Button {
|
||||
id: ignoreButton
|
||||
text: "Ignore"
|
||||
onClicked: root.click(Message.Ignore)
|
||||
visible: root.standardButtons & Message.Ignore
|
||||
}
|
||||
Button {
|
||||
id: applyButton
|
||||
text: "Apply"
|
||||
onClicked: root.click(Message.Apply)
|
||||
visible: root.standardButtons & Message.Apply
|
||||
}
|
||||
Button {
|
||||
id: yesButton
|
||||
text: "Yes"
|
||||
onClicked: root.click(Message.Yes)
|
||||
visible: root.standardButtons & Message.Yes
|
||||
}
|
||||
Button {
|
||||
id: yesAllButton
|
||||
text: "Yes to All"
|
||||
onClicked: root.click(Message.YesToAll)
|
||||
visible: root.standardButtons & Message.YesToAll
|
||||
}
|
||||
Button {
|
||||
id: noButton
|
||||
text: "No"
|
||||
onClicked: root.click(Message.No)
|
||||
visible: root.standardButtons & Message.No
|
||||
}
|
||||
Button {
|
||||
id: noAllButton
|
||||
text: "No to All"
|
||||
onClicked: root.click(Message.NoToAll)
|
||||
visible: root.standardButtons & Message.NoToAll
|
||||
}
|
||||
Button {
|
||||
id: discardButton
|
||||
text: "Discard"
|
||||
onClicked: root.click(Message.Discard)
|
||||
visible: root.standardButtons & Message.Discard
|
||||
}
|
||||
Button {
|
||||
id: resetButton
|
||||
text: "Reset"
|
||||
onClicked: root.click(Message.Reset)
|
||||
visible: root.standardButtons & Message.Reset
|
||||
}
|
||||
Button {
|
||||
id: restoreDefaultsButton
|
||||
text: "Restore Defaults"
|
||||
onClicked: root.click(Message.RestoreDefaults)
|
||||
visible: root.standardButtons & Message.RestoreDefaults
|
||||
}
|
||||
Button {
|
||||
id: cancelButton
|
||||
text: "Cancel"
|
||||
onClicked: root.click(Message.Cancel)
|
||||
visible: root.standardButtons & Message.Cancel
|
||||
}
|
||||
Button {
|
||||
id: abortButton
|
||||
text: "Abort"
|
||||
onClicked: root.click(Message.Abort)
|
||||
visible: root.standardButtons & Message.Abort
|
||||
}
|
||||
Button {
|
||||
id: closeButton
|
||||
text: "Close"
|
||||
onClicked: root.click(Message.Close)
|
||||
visible: root.standardButtons & Message.Close
|
||||
}
|
||||
Button {
|
||||
id: moreButton
|
||||
text: "Show Details..."
|
||||
onClicked: content.state = (content.state === "" ? "expanded" : "")
|
||||
visible: root.detailedText.length > 0
|
||||
}
|
||||
Button {
|
||||
id: helpButton
|
||||
text: "Help"
|
||||
onClicked: root.click(Message.Help)
|
||||
visible: root.standardButtons & Message.Help
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: details
|
||||
width: parent.width
|
||||
implicitHeight: detailedText.implicitHeight + content.spacing
|
||||
height: 0
|
||||
clip: true
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: contentColumn.bottom
|
||||
topMargin: content.spacing
|
||||
leftMargin: content.outerSpacing
|
||||
rightMargin: content.outerSpacing
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
contentHeight: detailedText.height
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: content.spacing
|
||||
anchors.bottomMargin: content.outerSpacing
|
||||
TextEdit {
|
||||
id: detailedText
|
||||
text: root.detailedText
|
||||
width: details.width
|
||||
wrapMode: Text.WordWrap
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: edgeFade
|
||||
EdgeFade {
|
||||
fadeColor: palette.window
|
||||
topThreshold: flickable.atYBeginning ? 0 : content.spacing * 3
|
||||
bottomThreshold: flickable.atYEnd ? 0 : content.spacing * 3
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
sourceComponent: flickable.height < flickable.contentHeight ? edgeFade : undefined
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "expanded"
|
||||
PropertyChanges {
|
||||
target: details
|
||||
height: content.height - contentColumn.height - content.spacing - content.outerSpacing
|
||||
}
|
||||
PropertyChanges {
|
||||
target: content
|
||||
implicitHeight: contentColumn.implicitHeight + content.spacing * 2 +
|
||||
detailedText.implicitHeight + content.outerSpacing * 2
|
||||
}
|
||||
PropertyChanges {
|
||||
target: moreButton
|
||||
text: "Hide Details"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -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.1
|
||||
|
||||
QtMessageDialog { }
|
|
@ -6,6 +6,9 @@ IMPORT_VERSION = 1.1
|
|||
QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf
|
||||
|
||||
SOURCES += \
|
||||
qquickabstractmessagedialog.cpp \
|
||||
qquickplatformmessagedialog.cpp \
|
||||
qquickmessagedialog.cpp \
|
||||
qquickabstractfiledialog.cpp \
|
||||
qquickplatformfiledialog.cpp \
|
||||
qquickfiledialog.cpp \
|
||||
|
@ -19,6 +22,10 @@ SOURCES += \
|
|||
plugin.cpp
|
||||
|
||||
HEADERS += \
|
||||
qquickabstractmessagedialog_p.h \
|
||||
qquickplatformmessagedialog_p.h \
|
||||
qquickmessagedialog_p.h \
|
||||
qquickmessageattached_p.h \
|
||||
qquickabstractfiledialog_p.h \
|
||||
qquickplatformfiledialog_p.h \
|
||||
qquickfiledialog_p.h \
|
||||
|
@ -31,6 +38,8 @@ HEADERS += \
|
|||
qquickabstractdialog_p.h
|
||||
|
||||
QML_FILES += \
|
||||
DefaultMessageDialog.qml \
|
||||
WidgetMessageDialog.qml \
|
||||
DefaultFileDialog.qml \
|
||||
WidgetFileDialog.qml \
|
||||
DefaultColorDialog.qml \
|
||||
|
@ -40,9 +49,14 @@ QML_FILES += \
|
|||
qml/Button.qml \
|
||||
qml/CheckBox.qml \
|
||||
qml/ColorSlider.qml \
|
||||
qml/EdgeFade.qml \
|
||||
qml/DefaultWindowDecoration.qml \
|
||||
qml/TextField.qml \
|
||||
qml/qmldir \
|
||||
images/critical.png \
|
||||
images/information.png \
|
||||
images/question.png \
|
||||
images/warning.png \
|
||||
images/checkers.png \
|
||||
images/checkmark.png \
|
||||
images/copy.png \
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 253 B |
Binary file not shown.
After Width: | Height: | Size: 254 B |
Binary file not shown.
After Width: | Height: | Size: 257 B |
Binary file not shown.
After Width: | Height: | Size: 224 B |
|
@ -41,6 +41,10 @@
|
|||
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
#include "qquickmessagedialog_p.h"
|
||||
#include "qquickabstractmessagedialog_p.h"
|
||||
#include "qquickmessageattached_p.h"
|
||||
#include "qquickplatformmessagedialog_p.h"
|
||||
#include "qquickfiledialog_p.h"
|
||||
#include "qquickabstractfiledialog_p.h"
|
||||
#include "qquickplatformfiledialog_p.h"
|
||||
|
@ -68,7 +72,7 @@ QT_BEGIN_NAMESPACE
|
|||
To use the types in this module, import the module with the following line:
|
||||
|
||||
\code
|
||||
import QtQuick.Dialogs 1.0
|
||||
import QtQuick.Dialogs 1.1
|
||||
\endcode
|
||||
*/
|
||||
|
||||
|
@ -101,6 +105,15 @@ public:
|
|||
// possible to instantiate it from Qt Quick.
|
||||
// Otherwise fall back to a pure-QML implementation.
|
||||
|
||||
// MessageDialog
|
||||
qmlRegisterUncreatableType<QQuickMessageAttached>(uri, 1, 1, "Message", QQuickMessageAttached::tr("Message can only be used via the attached property."));
|
||||
#ifndef PURE_QML_ONLY
|
||||
if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::MessageDialog))
|
||||
qmlRegisterType<QQuickPlatformMessageDialog>(uri, 1, 0, "MessageDialog");
|
||||
else
|
||||
#endif
|
||||
registerWidgetOrQmlImplementation<QQuickMessageDialog>(widgetsDir, qmlDir, "MessageDialog", uri, hasTopLevelWindows, 1, 1);
|
||||
|
||||
// FileDialog
|
||||
#ifndef PURE_QML_ONLY
|
||||
if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog))
|
||||
|
|
|
@ -50,7 +50,7 @@ Item {
|
|||
property alias containsMouse: mouseArea.containsMouse
|
||||
property alias pressed: mouseArea.pressed
|
||||
implicitHeight: Math.max(Screen.logicalPixelDensity * 7, buttonLabel.implicitHeight * 1.2)
|
||||
implicitWidth: Math.max(Screen.logicalPixelDensity * 11, buttonLabel.implicitWidth * 1.3)
|
||||
implicitWidth: visible ? Math.max(Screen.logicalPixelDensity * 11, buttonLabel.implicitWidth * 1.3) : 0
|
||||
height: implicitHeight
|
||||
width: implicitWidth
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*****************************************************************************
|
||||
**
|
||||
** 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
|
||||
|
||||
ShaderEffect {
|
||||
property color fadeColor
|
||||
property real topThreshold: 10
|
||||
property real bottomThreshold: 10
|
||||
property real _topRatio: topThreshold / height
|
||||
property real _bottomRatio: bottomThreshold / height
|
||||
z: 1
|
||||
fragmentShader: "
|
||||
varying lowp vec2 qt_TexCoord0;
|
||||
uniform lowp vec4 fadeColor;
|
||||
uniform highp float _topRatio;
|
||||
uniform highp float _bottomRatio;
|
||||
|
||||
void main() {
|
||||
highp float bottomEnd = 1. - _bottomRatio;
|
||||
gl_FragColor = fadeColor *
|
||||
(qt_TexCoord0.y < _topRatio ? 1. - qt_TexCoord0.y / _topRatio :
|
||||
(qt_TexCoord0.y > bottomEnd ? (qt_TexCoord0.y - bottomEnd) / _bottomRatio : 0.));
|
||||
}
|
||||
"
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
Button 1.0 Button.qml
|
||||
CheckBox 1.1 CheckBox.qml
|
||||
ColorSlider 1.0 ColorSlider.qml
|
||||
EdgeFade 1.0 EdgeFade.qml
|
||||
TextField 1.0 TextField.qml
|
||||
|
|
|
@ -110,8 +110,8 @@ Q_SIGNALS:
|
|||
|
||||
protected Q_SLOTS:
|
||||
void decorationLoaded();
|
||||
void accept();
|
||||
void reject();
|
||||
virtual void accept();
|
||||
virtual void reject();
|
||||
void visibleChanged(bool v);
|
||||
void windowGeometryChanged();
|
||||
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** 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 "qquickabstractmessagedialog_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QQuickAbstractMessageDialog::QQuickAbstractMessageDialog(QObject *parent)
|
||||
: QQuickAbstractDialog(parent)
|
||||
, m_dlgHelper(0)
|
||||
, m_options(QSharedPointer<QMessageDialogOptions>(new QMessageDialogOptions()))
|
||||
, m_clickedButton(NoButton)
|
||||
{
|
||||
}
|
||||
|
||||
QQuickAbstractMessageDialog::~QQuickAbstractMessageDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void QQuickAbstractMessageDialog::setVisible(bool v)
|
||||
{
|
||||
if (helper() && v)
|
||||
m_dlgHelper->setOptions(m_options);
|
||||
if (v)
|
||||
m_clickedButton = NoButton;
|
||||
QQuickAbstractDialog::setVisible(v);
|
||||
}
|
||||
|
||||
void QQuickAbstractMessageDialog::setTitle(const QString &arg)
|
||||
{
|
||||
if (arg != m_options->windowTitle()) {
|
||||
m_options->setWindowTitle(arg);
|
||||
emit titleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickAbstractMessageDialog::setText(const QString &arg)
|
||||
{
|
||||
if (arg != m_options->text()) {
|
||||
m_options->setText(arg);
|
||||
emit textChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickAbstractMessageDialog::setInformativeText(const QString &arg)
|
||||
{
|
||||
if (arg != m_options->informativeText()) {
|
||||
m_options->setInformativeText(arg);
|
||||
emit informativeTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickAbstractMessageDialog::setDetailedText(const QString &arg)
|
||||
{
|
||||
if (arg != m_options->detailedText()) {
|
||||
m_options->setDetailedText(arg);
|
||||
emit detailedTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickAbstractMessageDialog::setIcon(QQuickAbstractMessageDialog::Icon icon)
|
||||
{
|
||||
if (static_cast<int>(icon) != static_cast<int>(m_options->icon())) {
|
||||
m_options->setIcon(static_cast<QMessageDialogOptions::Icon>(icon));
|
||||
emit iconChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QUrl QQuickAbstractMessageDialog::standardIconSource()
|
||||
{
|
||||
switch (m_options->icon()) {
|
||||
case QMessageDialogOptions::Information:
|
||||
return QUrl("images/information.png");
|
||||
break;
|
||||
case QMessageDialogOptions::Warning:
|
||||
return QUrl("images/warning.png");
|
||||
break;
|
||||
case QMessageDialogOptions::Critical:
|
||||
return QUrl("images/critical.png");
|
||||
break;
|
||||
case QMessageDialogOptions::Question:
|
||||
return QUrl("images/question.png");
|
||||
break;
|
||||
default:
|
||||
return QUrl();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickAbstractMessageDialog::setStandardButtons(StandardButtons buttons)
|
||||
{
|
||||
if (buttons != m_options->standardButtons()) {
|
||||
m_options->setStandardButtons(static_cast<QMessageDialogOptions::StandardButtons>(static_cast<int>(buttons)));
|
||||
emit standardButtonsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickAbstractMessageDialog::click(QQuickAbstractMessageDialog::StandardButton button)
|
||||
{
|
||||
m_clickedButton = button;
|
||||
emit buttonClicked();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -0,0 +1,164 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** 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 QQUICKABSTRACTMESSAGEDIALOG_P_H
|
||||
#define QQUICKABSTRACTMESSAGEDIALOG_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 QQuickAbstractMessageDialog : public QQuickAbstractDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_ENUMS(Icon)
|
||||
Q_ENUMS(StandardButton)
|
||||
Q_FLAGS(StandardButtons)
|
||||
|
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
||||
Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged)
|
||||
Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText NOTIFY detailedTextChanged)
|
||||
Q_PROPERTY(Icon icon READ icon WRITE setIcon NOTIFY iconChanged)
|
||||
Q_PROPERTY(QUrl standardIconSource READ standardIconSource NOTIFY iconChanged)
|
||||
Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged)
|
||||
Q_PROPERTY(StandardButton clickedButton READ clickedButton NOTIFY buttonClicked)
|
||||
|
||||
public:
|
||||
QQuickAbstractMessageDialog(QObject *parent = 0);
|
||||
virtual ~QQuickAbstractMessageDialog();
|
||||
|
||||
virtual QString title() const { return m_options->windowTitle(); }
|
||||
QString text() const { return m_options->text(); }
|
||||
QString informativeText() const { return m_options->informativeText(); }
|
||||
QString detailedText() const { return m_options->detailedText(); }
|
||||
|
||||
enum Icon {
|
||||
NoIcon = QMessageDialogOptions::NoIcon,
|
||||
Information = QMessageDialogOptions::Information,
|
||||
Warning = QMessageDialogOptions::Warning,
|
||||
Critical = QMessageDialogOptions::Critical,
|
||||
Question = QMessageDialogOptions::Question
|
||||
};
|
||||
|
||||
Icon icon() const { return static_cast<Icon>(m_options->icon()); }
|
||||
|
||||
QUrl standardIconSource();
|
||||
|
||||
enum StandardButton {
|
||||
NoButton = QMessageDialogOptions::NoButton,
|
||||
Ok = QMessageDialogOptions::Ok,
|
||||
Save = QMessageDialogOptions::Save,
|
||||
SaveAll = QMessageDialogOptions::SaveAll,
|
||||
Open = QMessageDialogOptions::Open,
|
||||
Yes = QMessageDialogOptions::Yes,
|
||||
YesToAll = QMessageDialogOptions::YesToAll,
|
||||
No = QMessageDialogOptions::No,
|
||||
NoToAll = QMessageDialogOptions::NoToAll,
|
||||
Abort = QMessageDialogOptions::Abort,
|
||||
Retry = QMessageDialogOptions::Retry,
|
||||
Ignore = QMessageDialogOptions::Ignore,
|
||||
Close = QMessageDialogOptions::Close,
|
||||
Cancel = QMessageDialogOptions::Cancel,
|
||||
Discard = QMessageDialogOptions::Discard,
|
||||
Help = QMessageDialogOptions::Help,
|
||||
Apply = QMessageDialogOptions::Apply,
|
||||
Reset = QMessageDialogOptions::Reset,
|
||||
RestoreDefaults = QMessageDialogOptions::RestoreDefaults
|
||||
};
|
||||
Q_DECLARE_FLAGS(StandardButtons, StandardButton)
|
||||
|
||||
StandardButtons standardButtons() const { return static_cast<StandardButtons>(static_cast<int>(m_options->standardButtons())); }
|
||||
|
||||
StandardButton clickedButton() const { return m_clickedButton; }
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void setVisible(bool v);
|
||||
virtual void setTitle(const QString &arg);
|
||||
void setText(const QString &arg);
|
||||
void setInformativeText(const QString &arg);
|
||||
void setDetailedText(const QString &arg);
|
||||
void setIcon(Icon icon);
|
||||
void setStandardButtons(StandardButtons buttons);
|
||||
void click(StandardButton button);
|
||||
|
||||
Q_SIGNALS:
|
||||
void textChanged();
|
||||
void informativeTextChanged();
|
||||
void detailedTextChanged();
|
||||
void iconChanged();
|
||||
void standardButtonsChanged();
|
||||
void buttonClicked();
|
||||
void discard();
|
||||
void help();
|
||||
void yes();
|
||||
void no();
|
||||
void apply();
|
||||
void reset();
|
||||
|
||||
protected:
|
||||
QPlatformMessageDialogHelper *m_dlgHelper;
|
||||
QSharedPointer<QMessageDialogOptions> m_options;
|
||||
StandardButton m_clickedButton;
|
||||
|
||||
Q_DISABLE_COPY(QQuickAbstractMessageDialog)
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickAbstractMessageDialog::StandardButtons)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QQUICKABSTRACTMESSAGEDIALOG_P_H
|
|
@ -0,0 +1,69 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtQml 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 QQUICKMESSAGEATTACHED_H
|
||||
#define QQUICKMESSAGEATTACHED_H
|
||||
|
||||
#include <private/qtquickglobal_p.h>
|
||||
#include <QtGui/qpa/qplatformdialoghelper.h>
|
||||
#include "qquickabstractmessagedialog_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_DECL_EXPORT QQuickMessageAttached : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(QQuickAbstractMessageDialog::Icon)
|
||||
Q_ENUMS(QQuickAbstractMessageDialog::StandardButton)
|
||||
|
||||
public:
|
||||
static QQuickMessageAttached *qmlAttachedProperties(QObject *obj) {
|
||||
return new QQuickMessageAttached(obj); }
|
||||
|
||||
QQuickMessageAttached(QObject *parent = 0) : QObject(parent) { }
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QML_DECLARE_TYPE(QQuickMessageAttached)
|
||||
QML_DECLARE_TYPEINFO(QQuickMessageAttached, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // QQUICKMESSAGEATTACHED_H
|
|
@ -0,0 +1,181 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** 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 "qquickmessagedialog_p.h"
|
||||
#include <QQuickItem>
|
||||
#include <private/qguiapplication_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\qmltype AbstractMessageDialog
|
||||
\instantiates QQuickMessageDialog
|
||||
\inqmlmodule QtQuick.Dialogs 1
|
||||
\ingroup qtquick-visual
|
||||
\brief API wrapper for QML message dialog implementations
|
||||
\since 5.2
|
||||
\internal
|
||||
|
||||
AbstractMessageDialog provides only the API for implementing a message 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::AbstractMessageDialog::accepted
|
||||
|
||||
This signal is emitted by \l accept().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlsignal QtQuick::Dialogs::AbstractMessageDialog::rejected
|
||||
|
||||
This signal is emitted by \l reject().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QQuickMessageDialog
|
||||
\inmodule QtQuick.Dialogs
|
||||
\internal
|
||||
|
||||
The QQuickMessageDialog class is a concrete subclass of
|
||||
\l QQuickAbstractMessageDialog, 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.2
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a message dialog wrapper with parent window \a parent.
|
||||
*/
|
||||
QQuickMessageDialog::QQuickMessageDialog(QObject *parent)
|
||||
: QQuickAbstractMessageDialog(parent)
|
||||
{
|
||||
connect(this, SIGNAL(buttonClicked()), this, SLOT(clicked()));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Destroys the message dialog wrapper.
|
||||
*/
|
||||
QQuickMessageDialog::~QQuickMessageDialog()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlproperty bool AbstractMessageDialog::visible
|
||||
|
||||
This property holds whether the dialog is visible. By default this is false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlproperty QObject AbstractMessageDialog::implementation
|
||||
|
||||
The QML object which implements the actual message dialog. Should be either a
|
||||
\l Window or an \l Item.
|
||||
*/
|
||||
|
||||
|
||||
void QQuickMessageDialog::clicked() {
|
||||
switch (m_clickedButton) {
|
||||
// This mapping from buttons to roles is the same as
|
||||
// documented for enum QMessageBox::StandardButton
|
||||
case Ok:
|
||||
case Open:
|
||||
case Save:
|
||||
case SaveAll:
|
||||
case Retry:
|
||||
case Ignore:
|
||||
accept();
|
||||
break;
|
||||
case Cancel:
|
||||
case Close:
|
||||
case Abort:
|
||||
reject();
|
||||
break;
|
||||
case Discard:
|
||||
emit discard();
|
||||
close();
|
||||
break;
|
||||
case Help:
|
||||
emit help();
|
||||
break;
|
||||
case Yes:
|
||||
case YesToAll:
|
||||
emit yes();
|
||||
close();
|
||||
break;
|
||||
case No:
|
||||
case NoToAll:
|
||||
emit no();
|
||||
close();
|
||||
break;
|
||||
case Apply:
|
||||
emit apply();
|
||||
break;
|
||||
case Reset:
|
||||
case RestoreDefaults:
|
||||
emit reset();
|
||||
break;
|
||||
default:
|
||||
qWarning("StandardButton %d has no role", m_clickedButton);
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickMessageDialog::accept() {
|
||||
// enter key is treated like OK
|
||||
if (m_clickedButton == NoButton)
|
||||
m_clickedButton = Ok;
|
||||
QQuickAbstractMessageDialog::accept();
|
||||
}
|
||||
|
||||
void QQuickMessageDialog::reject() {
|
||||
// escape key is treated like cancel
|
||||
if (m_clickedButton == NoButton)
|
||||
m_clickedButton = Cancel;
|
||||
QQuickAbstractMessageDialog::reject();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -0,0 +1,86 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** 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 QQUICKMESSAGEDIALOG_P_H
|
||||
#define QQUICKMESSAGEDIALOG_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 "qquickabstractmessagedialog_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQuickMessageDialog : public QQuickAbstractMessageDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
|
||||
Q_CLASSINFO("DefaultProperty", "implementation") // AbstractMessageDialog in QML can have only one child
|
||||
|
||||
public:
|
||||
explicit QQuickMessageDialog(QObject *parent = 0);
|
||||
~QQuickMessageDialog();
|
||||
|
||||
protected:
|
||||
virtual QPlatformDialogHelper *helper() { return 0; }
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void accept();
|
||||
virtual void reject();
|
||||
void clicked();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QQuickMessageDialog)
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QML_DECLARE_TYPE(QQuickMessageDialog *)
|
||||
|
||||
#endif // QQUICKMESSAGEDIALOG_P_H
|
|
@ -0,0 +1,206 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** 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 "qquickplatformmessagedialog_p.h"
|
||||
#include "qquickitem.h"
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <QWindow>
|
||||
#include <QQuickView>
|
||||
#include <QQuickWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\qmltype MessageDialog
|
||||
\instantiates QQuickPlatformMessageDialog
|
||||
\inqmlmodule QtQuick.Dialogs 1
|
||||
\ingroup dialogs
|
||||
\brief Dialog component for displaying popup messages.
|
||||
\since Qt 5.2
|
||||
|
||||
The most basic use case for a MessageDialog is a popup alert. It also
|
||||
allows the user to respond in various ways depending on which buttons are
|
||||
enabled. 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 show an alert and exit after the user
|
||||
responds:
|
||||
|
||||
\qml
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Dialogs 1.1
|
||||
|
||||
MessageDialog {
|
||||
id: messageDialog
|
||||
title: "May I have your attention please"
|
||||
text: "It's so cool that you are using Qt Quick."
|
||||
onAccepted: {
|
||||
console.log("And of course you could only agree.")
|
||||
Qt.quit()
|
||||
}
|
||||
Component.onCompleted: visible = true
|
||||
}
|
||||
\endqml
|
||||
|
||||
A MessageDialog 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 MessageDialog will be a platform message dialog if
|
||||
possible. If that isn't possible, then it will try to instantiate a
|
||||
\l QMessageBox. If that also isn't possible, then it will fall back to a QML
|
||||
implementation, DefaultMessageDialog.qml. In that case you can customize the
|
||||
appearance by editing this file. DefaultMessageDialog.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::MessageDialog::accepted
|
||||
|
||||
This handler is called when the user has pressed OK.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlsignal QtQuick::Dialogs::MessageDialog::rejected
|
||||
|
||||
This handler is called when the user has dismissed the dialog,
|
||||
either by closing the dialog window or by pressing the Cancel button.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QQuickPlatformMessageDialog
|
||||
\inmodule QtQuick.Dialogs
|
||||
\internal
|
||||
|
||||
\brief The QQuickPlatformMessageDialog class provides a message dialog
|
||||
|
||||
The dialog is implemented via the QPlatformMessageDialogHelper when possible;
|
||||
otherwise it falls back to a QMessageBox or a QML implementation.
|
||||
|
||||
\since 5.2
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a file dialog with parent window \a parent.
|
||||
*/
|
||||
QQuickPlatformMessageDialog::QQuickPlatformMessageDialog(QObject *parent) :
|
||||
QQuickAbstractMessageDialog(parent)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the file dialog.
|
||||
*/
|
||||
QQuickPlatformMessageDialog::~QQuickPlatformMessageDialog()
|
||||
{
|
||||
if (m_dlgHelper)
|
||||
m_dlgHelper->hide();
|
||||
delete m_dlgHelper;
|
||||
}
|
||||
|
||||
QPlatformMessageDialogHelper *QQuickPlatformMessageDialog::helper()
|
||||
{
|
||||
QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
|
||||
if (parentItem)
|
||||
m_parentWindow = parentItem->window();
|
||||
|
||||
if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
|
||||
usePlatformNativeDialog(QPlatformTheme::MessageDialog) ) {
|
||||
m_dlgHelper = static_cast<QPlatformMessageDialogHelper *>(QGuiApplicationPrivate::platformTheme()
|
||||
->createPlatformDialogHelper(QPlatformTheme::MessageDialog));
|
||||
if (!m_dlgHelper)
|
||||
return m_dlgHelper;
|
||||
connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
|
||||
connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
return m_dlgHelper;
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlproperty bool MessageDialog::visible
|
||||
|
||||
This property holds whether the dialog is visible. By default this is
|
||||
false.
|
||||
|
||||
\sa modality
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlproperty Qt::WindowModality MessageDialog::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 \c Qt.WindowModal.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlmethod void MessageDialog::open()
|
||||
|
||||
Shows the dialog to the user. It is equivalent to setting \l visible to
|
||||
true.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlmethod void MessageDialog::close()
|
||||
|
||||
Closes the dialog.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlproperty string MessageDialog::title
|
||||
|
||||
The title of the dialog window.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -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 QQUICKPLATFORMMESSAGEDIALOG_P_H
|
||||
#define QQUICKPLATFORMMESSAGEDIALOG_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 "qquickabstractmessagedialog_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQuickPlatformMessageDialog : public QQuickAbstractMessageDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QQuickPlatformMessageDialog(QObject *parent = 0);
|
||||
virtual ~QQuickPlatformMessageDialog();
|
||||
|
||||
protected:
|
||||
QPlatformMessageDialogHelper *helper();
|
||||
|
||||
Q_DISABLE_COPY(QQuickPlatformMessageDialog)
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QML_DECLARE_TYPE(QQuickPlatformMessageDialog *)
|
||||
|
||||
#endif // QQUICKPLATFORMMESSAGEDIALOG_P_H
|
|
@ -0,0 +1,215 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtQml 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 "qquickqmessagebox_p.h"
|
||||
#include "qquickitem.h"
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <private/qqmlcontext_p.h>
|
||||
#include <QWindow>
|
||||
#include <QQuickWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QAbstractButton>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QMessageBoxHelper : public QPlatformMessageDialogHelper
|
||||
{
|
||||
public:
|
||||
QMessageBoxHelper() {
|
||||
connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
|
||||
connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
|
||||
}
|
||||
|
||||
virtual void exec() { m_dialog.exec(); }
|
||||
|
||||
virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
|
||||
m_dialog.winId();
|
||||
QWindow *window = m_dialog.windowHandle();
|
||||
Q_ASSERT(window);
|
||||
window->setTransientParent(parent);
|
||||
window->setFlags(f);
|
||||
m_dialog.setWindowModality(m);
|
||||
m_dialog.setWindowTitle(QPlatformMessageDialogHelper::options()->windowTitle());
|
||||
m_dialog.setIcon(static_cast<QMessageBox::Icon>(QPlatformMessageDialogHelper::options()->icon()));
|
||||
if (!QPlatformMessageDialogHelper::options()->text().isNull())
|
||||
m_dialog.setText(QPlatformMessageDialogHelper::options()->text());
|
||||
if (!QPlatformMessageDialogHelper::options()->informativeText().isNull())
|
||||
m_dialog.setInformativeText(QPlatformMessageDialogHelper::options()->informativeText());
|
||||
if (!QPlatformMessageDialogHelper::options()->detailedText().isNull())
|
||||
m_dialog.setDetailedText(QPlatformMessageDialogHelper::options()->detailedText());
|
||||
m_dialog.setStandardButtons(static_cast<QMessageBox::StandardButtons>(static_cast<int>(
|
||||
QPlatformMessageDialogHelper::options()->standardButtons())));
|
||||
m_dialog.show();
|
||||
return m_dialog.isVisible();
|
||||
}
|
||||
|
||||
virtual void hide() { m_dialog.hide(); }
|
||||
|
||||
QMessageBox m_dialog;
|
||||
};
|
||||
|
||||
/*!
|
||||
\qmltype QtMessageDialog
|
||||
\instantiates QQuickQMessageBox
|
||||
\inqmlmodule QtQuick.PrivateWidgets 1
|
||||
\ingroup qtquick-visual
|
||||
\brief Dialog component for choosing a color.
|
||||
\since 5.2
|
||||
\internal
|
||||
|
||||
QtMessageDialog provides a means to instantiate and manage a QMessageBox.
|
||||
It is not recommended to be used directly; it is an implementation
|
||||
detail of \l MessageDialog in the \l QtQuick.Dialogs module.
|
||||
|
||||
To use this type, you will need to import the module with the following line:
|
||||
\code
|
||||
import QtQuick.PrivateWidgets 1.1
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlsignal QtQuick::Dialogs::MessageDialog::accepted
|
||||
|
||||
The \a accepted signal is emitted when the user has pressed the OK button
|
||||
on the dialog.
|
||||
|
||||
Example:
|
||||
|
||||
\qml
|
||||
MessageDialog {
|
||||
onAccepted: { console.log("accepted") }
|
||||
}
|
||||
\endqml
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlsignal QtQuick::Dialogs::MessageDialog::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 QQuickQMessageBox
|
||||
\inmodule QtQuick.PrivateWidgets
|
||||
\internal
|
||||
|
||||
\brief The QQuickQMessageBox class is a wrapper for a QMessageBox.
|
||||
|
||||
\since 5.2
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a message dialog with parent window \a parent.
|
||||
*/
|
||||
QQuickQMessageBox::QQuickQMessageBox(QObject *parent)
|
||||
: QQuickAbstractMessageDialog(parent)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the message dialog.
|
||||
*/
|
||||
QQuickQMessageBox::~QQuickQMessageBox()
|
||||
{
|
||||
if (m_dlgHelper)
|
||||
m_dlgHelper->hide();
|
||||
delete m_dlgHelper;
|
||||
}
|
||||
|
||||
void QQuickQMessageBox::finished(int button) {
|
||||
click(static_cast<StandardButton>(button));
|
||||
}
|
||||
|
||||
void QQuickQMessageBox::clicked(QAbstractButton* button) {
|
||||
QMessageBox &mb = static_cast<QMessageBoxHelper*>(QQuickAbstractMessageDialog::m_dlgHelper)->m_dialog;
|
||||
switch (mb.buttonRole(button)) {
|
||||
case QMessageBox::AcceptRole:
|
||||
emit accepted();
|
||||
break;
|
||||
case QMessageBox::RejectRole:
|
||||
emit rejected();
|
||||
break;
|
||||
case QMessageBox::DestructiveRole:
|
||||
emit discard();
|
||||
break;
|
||||
case QMessageBox::HelpRole:
|
||||
emit help();
|
||||
break;
|
||||
case QMessageBox::YesRole:
|
||||
emit yes();
|
||||
break;
|
||||
case QMessageBox::NoRole:
|
||||
emit no();
|
||||
break;
|
||||
case QMessageBox::ApplyRole:
|
||||
emit apply();
|
||||
break;
|
||||
case QMessageBox::ResetRole:
|
||||
emit reset();
|
||||
break;
|
||||
default:
|
||||
qWarning("unhandled QMessageBox button role %d", mb.buttonRole(button));
|
||||
}
|
||||
if (!mb.isVisible())
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
QPlatformDialogHelper *QQuickQMessageBox::helper()
|
||||
{
|
||||
QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
|
||||
if (parentItem)
|
||||
m_parentWindow = parentItem->window();
|
||||
|
||||
if (!QQuickAbstractMessageDialog::m_dlgHelper) {
|
||||
QMessageBoxHelper* helper = new QMessageBoxHelper();
|
||||
QQuickAbstractMessageDialog::m_dlgHelper = helper;
|
||||
connect(helper, SIGNAL(accept()), this, SLOT(accept()));
|
||||
connect(helper, SIGNAL(reject()), this, SLOT(reject()));
|
||||
connect(&helper->m_dialog, SIGNAL(finished(int)), this, SLOT(finished(int)));
|
||||
connect(&helper->m_dialog, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(clicked(QAbstractButton*)));
|
||||
}
|
||||
|
||||
return QQuickAbstractMessageDialog::m_dlgHelper;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -0,0 +1,86 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtQml 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 QQUICKQMESSAGEBOX_P_H
|
||||
#define QQUICKQMESSAGEBOX_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 <QMessageBox>
|
||||
#include "../dialogs/qquickabstractmessagedialog_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAbstractButton;
|
||||
|
||||
class QQuickQMessageBox : public QQuickAbstractMessageDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QQuickQMessageBox(QObject *parent = 0);
|
||||
virtual ~QQuickQMessageBox();
|
||||
|
||||
protected slots:
|
||||
void clicked(QAbstractButton* button);
|
||||
void finished(int button);
|
||||
|
||||
protected:
|
||||
virtual QPlatformDialogHelper *helper();
|
||||
|
||||
protected:
|
||||
Q_DISABLE_COPY(QQuickQMessageBox)
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QML_DECLARE_TYPE(QQuickQMessageBox *)
|
||||
|
||||
#endif // QQUICKQMESSAGEBOX_P_H
|
|
@ -4,6 +4,8 @@ TARGETPATH = QtQuick/PrivateWidgets
|
|||
IMPORT_VERSION = 1.1
|
||||
|
||||
SOURCES += \
|
||||
qquickqmessagebox.cpp \
|
||||
../dialogs/qquickabstractmessagedialog.cpp \
|
||||
qquickqfiledialog.cpp \
|
||||
../dialogs/qquickabstractfiledialog.cpp \
|
||||
qquickqcolordialog.cpp \
|
||||
|
@ -14,6 +16,8 @@ SOURCES += \
|
|||
widgetsplugin.cpp
|
||||
|
||||
HEADERS += \
|
||||
qquickqmessagebox_p.h \
|
||||
../dialogs/qquickabstractmessagedialog_p.h \
|
||||
qquickqfiledialog_p.h \
|
||||
../dialogs/qquickabstractfiledialog_p.h \
|
||||
qquickqcolordialog_p.h \
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
#include <QtQml/qqml.h>
|
||||
#include "qquickqmessagebox_p.h"
|
||||
#include "qquickqfiledialog_p.h"
|
||||
#include "qquickqcolordialog_p.h"
|
||||
#include "qquickqfontdialog_p.h"
|
||||
|
@ -60,7 +61,7 @@ QT_BEGIN_NAMESPACE
|
|||
and to provide fallback implementations in case they fail to load.
|
||||
|
||||
\code
|
||||
import QtQuick.PrivateWidgets 1.0
|
||||
import QtQuick.PrivateWidgets 1.1
|
||||
\endcode
|
||||
|
||||
\since 5.1
|
||||
|
@ -76,6 +77,7 @@ public:
|
|||
{
|
||||
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.PrivateWidgets"));
|
||||
|
||||
qmlRegisterType<QQuickQMessageBox>(uri, 1, 1, "QtMessageDialog");
|
||||
qmlRegisterType<QQuickQFileDialog>(uri, 1, 0, "QtFileDialog");
|
||||
qmlRegisterType<QQuickQColorDialog>(uri, 1, 0, "QtColorDialog");
|
||||
qmlRegisterType<QQuickQFontDialog>(uri, 1, 1, "QtFontDialog");
|
||||
|
|
Loading…
Reference in New Issue