Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Use of popup window
Forum Updated to NodeBB v4.3 + New Features

Use of popup window

Scheduled Pinned Locked Moved General and Desktop
15 Posts 5 Posters 30.1k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    koahnig
    wrote on last edited by
    #6

    you might want to "check out":http://doc.qt.nokia.com/4.7/qmessagebox.html#addButton

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #7

      QMessageBox::addButton()

      and set a parent for centered display.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gogoi
        wrote on last edited by
        #8

        hello volker

        I have tried it like this..it work but it add only one button at a time..

        @QMessageBox messageBox(this);
        QAbstractButton *addButton =
        messageBox.addButton(tr("Add"), QMessageBox::ActionRole);

         messageBox.exec();
         if (messageBox.clickedButton() == addButton)
             exit(0);@
        

        i mean to say that if i want to add two or more button the same messagebox than what should i do here if i add another button say save in the message box than it only display save button ..

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #9

          Does the API doc state that it's forbidden to call addButton() twice?

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gogoi
            wrote on last edited by
            #10

            that thing i havent found in the API but when i write

            @QAbstractButton *saveButton =
            messageBox.addButton(tr("save"), QMessageBox::ActionRole);@ in the above code than it overide the previous button

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #11

              No.

              Neither on a Mac nor on Linux.

              I cannot check on mobile platforms, but I seriously doubt it's different there.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jim_kaiser
                wrote on last edited by
                #12

                If you want to do that.. use the static members of QMessageBox and pass the StandardButtons with "|" like Ok | Cancel.

                "Documentation":http://doc.qt.nokia.com/latest/qmessagebox.html#static-public-members

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  gogoi
                  wrote on last edited by
                  #13

                  actually i want to change the name of each action in messagebox by my own names..means can i change
                  QMessageBox ::Ok with QMessageBox ::AddNew..

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #14

                    Did you try reading the documentation for QMessageBox? Did you find a method there to gain access to the actual buttons? If no, you did not look hard enough, and should look again. Come on: you have been told over and over again to read the docs better. You are even telling others to do that. The time you have wasted on this (and other topics) would be better spend studying the documentation.

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      gogoi
                      wrote on last edited by
                      #15

                      yeh i have tried the doc example its working but the thing is that in simulator it show all three button in message box but in device it only show two buttons instead of three..the code i have written is..

                      @QMessageBox msgBox;
                      QPushButton *connectButton = msgBox.addButton(tr("Ok"), QMessageBox::ActionRole);
                      QPushButton *connectButton1 = msgBox.addButton(tr("AddNotes"), QMessageBox::ActionRole);
                      QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort);

                           msgBox.exec();
                      
                           if (msgBox.clickedButton() == connectButton) {
                               // connect
                           } else if (msgBox.clickedButton() == abortButton) {
                               // abort
                           }@
                      
                      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