Solved Could I costume Button text in MessageDialog?
-
MessageDialog has lots of Standard buttons such as Yes, No, Discard and so forth. But when I want to list some words on the button such as choosing "Public Share" or "Private Share".
Could I achieve it?
Thanks a lot. -
@Bayesky
You can implement a custom dialog.
See some examples:
https://doc.qt.io/qt-5/qtquickdialogs-systemdialogs-customdialogs-qml.html -
@KillerSmath
It would seem custom dialog had not ability to change text on button.
I mean when users click share file button, then a dialog pops-up asking for authorization to share their file. So button texts are "Public" on the left and "Private" on the right instead of "Yes" and "No" or "OK" and "Cancel".
Thank you for your reply. -
@Bayesky
I told about custom dialog because you could implement a MessageBox with custom Buttons.Just an example:
Dialog { id: customDialog title: "Visibility" signal publicClicked() signal privateClicked() ColumnLayout { id: column width: parent ? parent.width : 100 Label { text: "What visibility do you prefer ?" Layout.columnSpan: 2 Layout.fillWidth: true } RowLayout { Layout.alignment: Qt.AlignRight Button{ text: "Public" onClicked: { customDialog.publicClicked(); close(); } } Button{ text: "Private" onClicked: { customDialog.privateClicked(); close(); } } } } }
-
@KillerSmath
It works!!! Thank you very much!! -
@Bayesky
You welcome. -
This post is deleted!