aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp1
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp39
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p.h3
-rw-r--r--tests/auto/controls/data/tst_dialogbuttonbox.qml12
4 files changed, 49 insertions, 6 deletions
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index cfc05f5d..c02573ce 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -269,6 +269,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickAction>(uri, 2, 3, "Action");
qmlRegisterType<QQuickActionGroup>(uri, 2, 3, "ActionGroup");
qmlRegisterType<QQuickButtonGroup, 3>(uri, 2, 3, "ButtonGroup");
+ qmlRegisterType<QQuickDialogButtonBox>(uri, 2, 3, "DialogButtonBox");
qRegisterMetaType<QQuickIcon>();
qmlRegisterType<QQuickRangeSlider, 3>(uri, 2, 3, "RangeSlider");
qmlRegisterType<QQuickScrollBar, 3>(uri, 2, 3, "ScrollBar");
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 3c422268..b6136f4b 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -122,6 +122,36 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \since QtQuick.Controls 2.3
+ \qmlsignal QtQuick.Controls::DialogButtonBox::applied()
+
+ This signal is emitted when a button defined with the \c ApplyRole is
+ clicked.
+
+ \sa discarded(), reset()
+*/
+
+/*!
+ \since QtQuick.Controls 2.3
+ \qmlsignal QtQuick.Controls::DialogButtonBox::reset()
+
+ This signal is emitted when a button defined with the \c ResetRole is
+ clicked.
+
+ \sa discarded(), applied()
+*/
+
+/*!
+ \since QtQuick.Controls 2.3
+ \qmlsignal QtQuick.Controls::DialogButtonBox::discarded()
+
+ This signal is emitted when a button defined with the \c DiscardRole is
+ clicked.
+
+ \sa reset(), applied()
+*/
+
+/*!
\qmlsignal QtQuick.Controls::DialogButtonBox::helpRequested()
This signal is emitted when a button defined with the \c HelpRole is clicked.
@@ -300,6 +330,15 @@ void QQuickDialogButtonBoxPrivate::handleClick()
case QPlatformDialogHelper::NoRole:
emit q->rejected();
break;
+ case QPlatformDialogHelper::ApplyRole:
+ emit q->applied();
+ break;
+ case QPlatformDialogHelper::ResetRole:
+ emit q->reset();
+ break;
+ case QPlatformDialogHelper::DestructiveRole:
+ emit q->discarded();
+ break;
case QPlatformDialogHelper::HelpRole:
emit q->helpRequested();
break;
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p.h
index 9bd92c79..5d6e568e 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox_p.h
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p.h
@@ -98,6 +98,9 @@ Q_SIGNALS:
void accepted();
void rejected();
void helpRequested();
+ Q_REVISION(3) void applied();
+ Q_REVISION(3) void reset();
+ Q_REVISION(3) void discarded();
void clicked(QQuickAbstractButton *button);
void positionChanged();
diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml
index 9b3d969f..044c9593 100644
--- a/tests/auto/controls/data/tst_dialogbuttonbox.qml
+++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml
@@ -159,10 +159,10 @@ TestCase {
{ tag: "Save", standardButton: DialogButtonBox.Save, buttonRole: DialogButtonBox.AcceptRole, signalName: "accepted" },
{ tag: "Cancel", standardButton: DialogButtonBox.Cancel, buttonRole: DialogButtonBox.RejectRole, signalName: "rejected" },
{ tag: "Close", standardButton: DialogButtonBox.Close, buttonRole: DialogButtonBox.RejectRole, signalName: "rejected" },
- { tag: "Discard", standardButton: DialogButtonBox.Discard, buttonRole: DialogButtonBox.DestructiveRole },
- { tag: "Apply", standardButton: DialogButtonBox.Apply, buttonRole: DialogButtonBox.ApplyRole },
- { tag: "Reset", standardButton: DialogButtonBox.Reset, buttonRole: DialogButtonBox.ResetRole },
- { tag: "RestoreDefaults", standardButton: DialogButtonBox.RestoreDefaults, buttonRole: DialogButtonBox.ResetRole },
+ { tag: "Discard", standardButton: DialogButtonBox.Discard, buttonRole: DialogButtonBox.DestructiveRole, signalName: "discarded" },
+ { tag: "Apply", standardButton: DialogButtonBox.Apply, buttonRole: DialogButtonBox.ApplyRole, signalName: "applied" },
+ { tag: "Reset", standardButton: DialogButtonBox.Reset, buttonRole: DialogButtonBox.ResetRole, signalName: "reset" },
+ { tag: "RestoreDefaults", standardButton: DialogButtonBox.RestoreDefaults, buttonRole: DialogButtonBox.ResetRole, signalName: "reset" },
{ tag: "Help", standardButton: DialogButtonBox.Help, buttonRole: DialogButtonBox.HelpRole, signalName: "helpRequested" },
{ tag: "SaveAll", standardButton: DialogButtonBox.SaveAll, buttonRole: DialogButtonBox.AcceptRole, signalName: "accepted" },
{ tag: "Yes", standardButton: DialogButtonBox.Yes, buttonRole: DialogButtonBox.YesRole, signalName: "accepted" },
@@ -188,11 +188,11 @@ TestCase {
var clickedSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"})
verify(clickedSpy.valid)
var roleSpy = signalSpy.createObject(control, {target: control, signalName: data.signalName})
- compare(roleSpy.valid, !!data.signalName)
+ verify(roleSpy.valid)
button.clicked()
compare(clickedSpy.count, 1)
compare(clickedSpy.signalArguments[0][0], button)
- compare(roleSpy.count, !!data.signalName ? 1 : 0)
+ compare(roleSpy.count, 1)
}
}