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

MessageWindow

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.3k 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.
  • R Offline
    R Offline
    radhikak1394
    wrote on last edited by
    #1

    MessageWindow->show() and MessageWindow->exec() difference ? and where would what be appropriate to use ?

    jsulmJ 1 Reply Last reply
    0
    • R radhikak1394

      MessageWindow->show() and MessageWindow->exec() difference ? and where would what be appropriate to use ?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @radhikak1394 I guess you mean QMessageBox (there is no class called MessageWindow in Qt)?
      If so why not go to the documentation?
      exec(): http://doc.qt.io/qt-5/qmessagebox.html#exec - it shows the dialog as a modal dialog. This means main window is blocked and only message box can be used (it stays in foreground).

      show(): http://doc.qt.io/qt-5/qwidget.html#show - shows the dialog in non modal mode. Means: all application windows/dialogs can be used and this message box can go to the background.

      Appropriate use depends on your needs. If you want to show a message box and prevent the user from using the app before closing the box then use exec(), else use show()...

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply
      3
      • jsulmJ jsulm

        @radhikak1394 I guess you mean QMessageBox (there is no class called MessageWindow in Qt)?
        If so why not go to the documentation?
        exec(): http://doc.qt.io/qt-5/qmessagebox.html#exec - it shows the dialog as a modal dialog. This means main window is blocked and only message box can be used (it stays in foreground).

        show(): http://doc.qt.io/qt-5/qwidget.html#show - shows the dialog in non modal mode. Means: all application windows/dialogs can be used and this message box can go to the background.

        Appropriate use depends on your needs. If you want to show a message box and prevent the user from using the app before closing the box then use exec(), else use show()...

        R Offline
        R Offline
        radhikak1394
        wrote on last edited by
        #3

        @jsulm Thanks for the above response. So exec() is returning Rejected(0) , and the popup seems to vanish without user's response. could you help me with this ?

        JonBJ 1 Reply Last reply
        0
        • R radhikak1394

          @jsulm Thanks for the above response. So exec() is returning Rejected(0) , and the popup seems to vanish without user's response. could you help me with this ?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @radhikak1394
          QMessageBox::exec() (or QDialog, or whatever it is you are actually using?) will not return anything or vanish on its own (docs: "Shows the message box as a modal dialog, blocking until the user closes it."). Show your relevant code for creating/handling your "message box"?

          1 Reply Last reply
          2

          • Login

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