This is a request to see if anyone has found any work-arounds or hacks to prevent the somewhat random placement of X11 Qt windows. These X11 pecularities are discussed at the bottom of this page in the Qt documentation. This occurs often in my software, where I need to display a window, then popup and error message, which always appears way off on in different screen (top left). This locks up the main application (modality) and drags down my user's experience and trust in my software.
I'm running RHEL 7.2 KDE (X11 based system). My searches for solutions and attempts have been fruitless the past few days.
My semi solution ideas: I'm considering implementing a status bar at the bottom that displays errors.. but I feel that's too easy to ignore and doesn't have the alarming affect as a popup. For sub windows from my main application, I set the popup's parent to the main window and so that it at least the popup appears on top of the main window and not up on a random monitor.
Minimum reproducible example in a Qt 5.13 environment:
void MainWindow::on_actionShowEditorWindow_pressed() // called from a menu on a QMainWindow
{
editorWindow.show(); //editor Window is a QMainWindow
editorWindow.activateWindow(); // to request focus
// according to Qt documentation X11 systems asynchronously calculate the screen position after .show()
// so when the message below is displayed, the window manager doesn't know where the editor window is, so it defaults to the top left screen
QMessageBox::warning(editorWindow, tr("title"), "This message always appears on the top left screen");
}
Here's my editorWindow constructor:
EditorWindow::EditorWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::EditorWindow)
{
ui->setupUi(this);
}
My window manager is kwin, running KDE on RHEL 7.2. Most of my users run a 4 monitor setup and the environments are RHEL 7.2 with a mix of gnome and KDE.
Thanks to anyone who can help.
Edit: I'm currently looking into configuring kwin, my windows manager, for a fix.