Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Could I costume Button text in MessageDialog?
Forum Update on Monday, May 27th 2025

Could I costume Button text in MessageDialog?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
7 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bayesky
    wrote on last edited by
    #1

    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.

    KillerSmathK 1 Reply Last reply
    0
    • B Bayesky

      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.

      KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by
      #2

      @Bayesky
      You can implement a custom dialog.
      See some examples:
      https://doc.qt.io/qt-5/qtquickdialogs-systemdialogs-customdialogs-qml.html

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      1 Reply Last reply
      1
      • B Offline
        B Offline
        Bayesky
        wrote on last edited by
        #3

        @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.

        KillerSmathK 1 Reply Last reply
        0
        • B Bayesky

          @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.

          KillerSmathK Offline
          KillerSmathK Offline
          KillerSmath
          wrote on last edited by
          #4

          @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();
                              }
                          }
                      }
                  }
              }
          

          @Computer Science Student - Brazil
          Web Developer and Researcher
          “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

          B 1 Reply Last reply
          2
          • KillerSmathK KillerSmath

            @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();
                                }
                            }
                        }
                    }
                }
            
            B Offline
            B Offline
            Bayesky
            wrote on last edited by
            #5

            @KillerSmath
            It works!!! Thank you very much!!

            KillerSmathK 1 Reply Last reply
            0
            • B Bayesky

              @KillerSmath
              It works!!! Thank you very much!!

              KillerSmathK Offline
              KillerSmathK Offline
              KillerSmath
              wrote on last edited by
              #6

              @Bayesky
              You welcome.

              @Computer Science Student - Brazil
              Web Developer and Researcher
              “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

              1 Reply Last reply
              0
              • J Offline
                J Offline
                Jarrell26
                Banned
                wrote on last edited by Jarrell26
                #7
                This post is deleted!
                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved