qt - QML: MessageDialog , the ordering of standardButtons and setting default button -
i have in main.qml following code
messagedialog { id: exitdialog title: "quit" text: "save before quitting?" icon: standardicon.question standardbuttons: standardbutton.save| standardbutton.discard | standardbutton.cancel onaccepted: { ... } ondiscard: qt.quit() }
the problem buttons me appear close without saving cancel , last save! default button set close without saving. i want order of buttons in code maintained , default set save. face such problems? suggestions ?
i have seen answer how set default button of messagedialog in qml? how do standardbuttons?
just give idea. http://doc.qt.io/qt-5/qmessagebox.html
the display order buttons platform-dependent. example, on windows, save displayed left of cancel, whereas on mac os, order reversed.
mark 1 of standard buttons default button.
qmessagebox msgbox; msgbox.settext("the document has been modified."); msgbox.setinformativetext("do want save changes?"); msgbox.setstandardbuttons(qmessagebox::save | qmessagebox::discard | qmessagebox::cancel); msgbox.setdefaultbutton(qmessagebox::save); int ret = msgbox.exec();
Comments
Post a Comment