detailedText: customizeDetailedText.checked ? detailedTextField.text : ""
onButtonClicked: console.log("clicked button " + clickedButton)
onAccepted: lastChosen.text = "Accepted " +
- (clickedButton == Message.Ok ? "(OK)" : (clickedButton == Message.Retry ? "(Retry)" : "(Ignore)"))
+ (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)"))
onRejected: lastChosen.text = "Rejected " +
- (clickedButton == Message.Close ? "(Close)" : (clickedButton == Message.Abort ? "(Abort)" : "(Cancel)"))
+ (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.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!")
+ 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"
}
function updateIcon(icon, checked) {
if (updating) return
updating = true
- messageDialog.icon = (checked ? icon : Message.NoIcon)
+ messageDialog.icon = (checked ? icon : StandardIcon.NoIcon)
for (var i = 0; i < children.length; ++i)
if (children[i].icon !== icon)
children[i].checked = false
CheckBox {
id: iconInformation
text: "Information"
- property int icon: Message.Information
+ property int icon: StandardIcon.Information
onCheckedChanged: parent.updateIcon(icon, checked)
}
id: iconWarning
text: "Warning"
checked: true
- property int icon: Message.Warning
+ property int icon: StandardIcon.Warning
onCheckedChanged: parent.updateIcon(icon, checked)
Component.onCompleted: parent.updateIcon(icon, true)
}
CheckBox {
id: iconCritical
text: "Critical"
- property int icon: Message.Critical
+ property int icon: StandardIcon.Critical
onCheckedChanged: parent.updateIcon(icon, checked)
}
CheckBox {
id: iconQuestion
text: "Question"
- property int icon: Message.Question
+ property int icon: StandardIcon.Question
onCheckedChanged: parent.updateIcon(icon, checked)
}
}
if (children[i].checked)
buttons |= children[i].button
if (!buttons)
- buttons = Message.Ok
+ buttons = StandardButton.Ok
messageDialog.standardButtons = buttons
updating = false
}
CheckBox {
text: "Help"
- property int button: Message.Help
+ property int button: StandardButton.Help
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "Abort"
- property int button: Message.Abort
+ property int button: StandardButton.Abort
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "Close"
- property int button: Message.Close
+ property int button: StandardButton.Close
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "Cancel"
- property int button: Message.Cancel
+ property int button: StandardButton.Cancel
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "NoToAll"
- property int button: Message.NoToAll
+ property int button: StandardButton.NoToAll
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "No"
- property int button: Message.No
+ property int button: StandardButton.No
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "YesToAll"
- property int button: Message.YesToAll
+ property int button: StandardButton.YesToAll
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "Yes"
- property int button: Message.Yes
+ property int button: StandardButton.Yes
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "Ignore"
- property int button: Message.Ignore
+ property int button: StandardButton.Ignore
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "Retry"
- property int button: Message.Retry
+ property int button: StandardButton.Retry
onCheckedChanged: parent.updateButtons(button, checked)
}
CheckBox {
text: "OK"
checked: true
- property int button: Message.Ok
+ property int button: StandardButton.Ok
onCheckedChanged: parent.updateButtons(button, checked)
}
}
#include <QtQml/qqmlextensionplugin.h>
#include "qquickmessagedialog_p.h"
#include "qquickabstractmessagedialog_p.h"
-#include "qquickmessageattached_p.h"
+#include "qquickdialogassets_p.h"
#include "qquickplatformmessagedialog_p.h"
#include "qquickfiledialog_p.h"
#include "qquickabstractfiledialog_p.h"
// 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."));
+ qmlRegisterUncreatableType<QQuickStandardButton>(uri, 1, 1, "StandardButton",
+ QLatin1String("Do not create objects of type StandardButton"));
+ qmlRegisterUncreatableType<QQuickStandardIcon>(uri, 1, 1, "StandardIcon",
+ QLatin1String("Do not create objects of type StandardIcon"));
#ifndef PURE_QML_ONLY
if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::MessageDialog))
qmlRegisterType<QQuickPlatformMessageDialog>(uri, 1, 0, "MessageDialog");
**
****************************************************************************/
-#ifndef QQUICKMESSAGEATTACHED_H
-#define QQUICKMESSAGEATTACHED_H
+#ifndef QQUICKDIALOGASSETS_P_H
+#define QQUICKDIALOGASSETS_P_H
#include <private/qtquickglobal_p.h>
#include <QtGui/qpa/qplatformdialoghelper.h>
QT_BEGIN_NAMESPACE
-class Q_DECL_EXPORT QQuickMessageAttached : public QObject
+class QQuickStandardButton
{
- Q_OBJECT
- Q_ENUMS(QQuickAbstractMessageDialog::Icon)
+ Q_GADGET
Q_ENUMS(QQuickAbstractMessageDialog::StandardButton)
+};
-public:
- static QQuickMessageAttached *qmlAttachedProperties(QObject *obj) {
- return new QQuickMessageAttached(obj); }
-
- QQuickMessageAttached(QObject *parent = 0) : QObject(parent) { }
+class QQuickStandardIcon
+{
+ Q_GADGET
+ Q_ENUMS(QQuickAbstractMessageDialog::Icon)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QQuickMessageAttached)
-QML_DECLARE_TYPEINFO(QQuickMessageAttached, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQUICKMESSAGEATTACHED_H
+#endif // QQUICKDIALOGASSETS_P_H