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. QMessageBox didn't show on Linux (X11), and the app is unresponsive
Forum Update on Monday, May 27th 2025

QMessageBox didn't show on Linux (X11), and the app is unresponsive

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmessageboxqmainwindowlinuxunresponsivesubclass
2 Posts 2 Posters 267 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.
  • J Offline
    J Offline
    JackMyson
    wrote on 27 Apr 2024, 09:21 last edited by
    #1

    As mentioned in the title, the Qt application, with a QMessageBox sub-class and a multi-instantiable QMainWindow sub-class. Now the QMessageBox sub-class (the message box) should be constructed and exists in each QMainWindow sub-class (the main window) once only, with different titles, buttons, text and captions using only the one (and the same) instance.

    class SubClassedMessageBoxInfo : public QMessageBox {
        Q_OBJECT
    public:
        // ...
    };
    
    class SubClassedMessageBoxCritical; // ...
    
    // ...
    
    class SubClassedMainWindow : public QMainWindow {
        Q_OBJECT
    public:
        SubClassedMainWindow(QWidget *parent=nullptr)
            : QMainWindow(parent) {
            // ...
            m_infoMessage = new SubClassedMessageBoxInfo(this);
            m_criticalMessage = new SubClassedMessageBoxCritical(this);
           // ..
        }
    };
    

    The question is, whenever a user does anything that triggers a message box, no matter the critical message, the informative message, the "Would you like to save" message, the "Update Checker" message, ..., the app remains unresponsive. Only the user triggers the app externally twice (e.g., the only way I have discovered currently is Activities from the task and date time bar -> the app name -> Quit to trigger the "Would you like to save" message), the message box appears and everything acts normally from that time on till the app is being fully closed and quitted.

    My question: why? And most importantly, how to fix it?

    I'm using Qt 5.15.2 on Linux/X11 (Ubuntu) 23.04.

    By the way, thanks to Qt's platform-independent feature, I compiled the app on Windows also. But everything acted 200% normal and is expected, using the same code.

    If you require additional code, please reply. Any help will be appreciated.

    J 1 Reply Last reply 27 Apr 2024, 10:48
    0
    • J JackMyson
      27 Apr 2024, 09:21

      As mentioned in the title, the Qt application, with a QMessageBox sub-class and a multi-instantiable QMainWindow sub-class. Now the QMessageBox sub-class (the message box) should be constructed and exists in each QMainWindow sub-class (the main window) once only, with different titles, buttons, text and captions using only the one (and the same) instance.

      class SubClassedMessageBoxInfo : public QMessageBox {
          Q_OBJECT
      public:
          // ...
      };
      
      class SubClassedMessageBoxCritical; // ...
      
      // ...
      
      class SubClassedMainWindow : public QMainWindow {
          Q_OBJECT
      public:
          SubClassedMainWindow(QWidget *parent=nullptr)
              : QMainWindow(parent) {
              // ...
              m_infoMessage = new SubClassedMessageBoxInfo(this);
              m_criticalMessage = new SubClassedMessageBoxCritical(this);
             // ..
          }
      };
      

      The question is, whenever a user does anything that triggers a message box, no matter the critical message, the informative message, the "Would you like to save" message, the "Update Checker" message, ..., the app remains unresponsive. Only the user triggers the app externally twice (e.g., the only way I have discovered currently is Activities from the task and date time bar -> the app name -> Quit to trigger the "Would you like to save" message), the message box appears and everything acts normally from that time on till the app is being fully closed and quitted.

      My question: why? And most importantly, how to fix it?

      I'm using Qt 5.15.2 on Linux/X11 (Ubuntu) 23.04.

      By the way, thanks to Qt's platform-independent feature, I compiled the app on Windows also. But everything acted 200% normal and is expected, using the same code.

      If you require additional code, please reply. Any help will be appreciated.

      J Offline
      J Offline
      JonB
      wrote on 27 Apr 2024, 10:48 last edited by JonB
      #2

      @JackMyson
      You don't actually show the message box being shown (exec()?). Nothing special here. Try not subclassing the QMessageBox and using that directly, so you can rule that out. Try a standalone application without anything of your own. Try passing nullptr as parent to the constructor, any difference? Are you sure you are not using Wayland rather than Xorg, that might make its position or behaviour different.

      1 Reply Last reply
      0

      1/2

      27 Apr 2024, 09:21

      • Login

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