QMessageBox didn't show on Linux (X11), and the app is unresponsive
-
As mentioned in the title, the Qt application, with a
QMessageBox
sub-class and a multi-instantiableQMainWindow
sub-class. Now theQMessageBox
sub-class (the message box) should be constructed and exists in eachQMainWindow
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.
-
@JackMyson
You don't actually show the message box being shown (exec()
?). Nothing special here. Try not subclassing theQMessageBox
and using that directly, so you can rule that out. Try a standalone application without anything of your own. Try passingnullptr
asparent
to the constructor, any difference? Are you sure you are not using Wayland rather than Xorg, that might make its position or behaviour different.