From fa71ef5a2ccfa4666db9338c4ba8f34d19f2faf1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 22 Oct 2016 20:46:33 +0200 Subject: QQuickDialog: simplify the button box handling Just fill in the footer with a button box by default from the styles. This makes the next step easier, to provide also a default title bar in the header. Task-number: QTBUG-56711 Change-Id: I621a61f29f9ba2fe4b7e907d81da5988133a98c8 Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_dialog.qml | 51 ++++----------------------------- 1 file changed, 6 insertions(+), 45 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/controls/data/tst_dialog.qml b/tests/auto/controls/data/tst_dialog.qml index d4cbc222..632bb0c4 100644 --- a/tests/auto/controls/data/tst_dialog.qml +++ b/tests/auto/controls/data/tst_dialog.qml @@ -61,16 +61,6 @@ TestCase { DialogButtonBox { } } - Component { - id: headerBox - DialogButtonBox { position: DialogButtonBox.Header } - } - - Component { - id: footerBox - DialogButtonBox { position: DialogButtonBox.Footer } - } - Component { id: signalSpy SignalSpy { } @@ -80,8 +70,7 @@ TestCase { var control = dialog.createObject(testCase) verify(control) verify(!control.header) - verify(!control.footer) - verify(control.buttonBox) + verify(control.footer) compare(control.standardButtons, 0) control.destroy() } @@ -122,22 +111,18 @@ TestCase { function test_buttonBox_data() { return [ - { tag: "default header", property: "header", buttonBox: headerBox }, - { tag: "default footer", property: "footer", buttonBox: footerBox }, - { tag: "custom header", property: "header", position: DialogButtonBox.Header }, - { tag: "custom footer", property: "footer", position: DialogButtonBox.Footer } + { tag: "default" }, + { tag: "custom", custom: true } ] } function test_buttonBox(data) { var control = dialog.createObject(testCase) - if (data.buttonBox) - control.buttonBox = data.buttonBox - else - control[data.property] = buttonBox.createObject(testCase, {position: data.position}) + if (data.custom) + control.footer = buttonBox.createObject(testCase) control.standardButtons = Dialog.Ok | Dialog.Cancel - var box = control[data.property] + var box = control.footer verify(box) compare(box.standardButtons, Dialog.Ok | Dialog.Cancel) @@ -192,30 +177,6 @@ TestCase { control.destroy() } - function test_warnings() { - var control = dialog.createObject(testCase) - verify(control) - - var testComponent = Qt.createComponent("TestItem.qml") - verify(testComponent) - - control.buttonBox = headerBox - control.header = testComponent.createObject(testCase) - ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: Custom header detected. Cannot assign buttonBox as a header. No standard buttons will appear in the header.") - control.standardButtons = Dialog.Apply - - control.buttonBox = footerBox - control.footer = testComponent.createObject(testCase) - ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: Custom footer detected. Cannot assign buttonBox as a footer. No standard buttons will appear in the footer.") - control.standardButtons = Dialog.Cancel - - control.buttonBox = testComponent - ignoreWarning(Qt.resolvedUrl("tst_dialog.qml") + ":56:9: QML Dialog: buttonBox must be an instance of DialogButtonBox") - control.standardButtons = Dialog.Ok - - control.destroy() - } - function test_layout() { var control = dialog.createObject(testCase, {width: 100, height: 100}) verify(control) -- cgit v1.2.3