QMessageBox not centered on application
-
wrote on 18 Nov 2024, 14:31 last edited by Perdrix
Qt 6.8.0 on Linux (Ubuntu). Given:
QString message{ tr("Do you want to save the modifications?", "IDS_MSG_SAVEMODIFICATIONS") }; auto result = QMessageBox::question(this, "DeepSkyStacker", message, (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), QMessageBox::No);
I would expect the message box to be centered on the application or even the sub-window (this). However it appeared to be centered on the desktop.
What could I be doing wrong?
Thanks
David -
wrote on 20 Nov 2024, 21:45 last edited by IgKh
To try and help op progress, according to this the graphical system built into WSL uses the Weston compositor (not Gnome/Mutter), and it can't be (easily) replaced. I tried with a standalone Weston instance locally, and can reproduce the issue - the modal
QMessageBox
just pop ups at a random location each time, while under KWin it always opens centered in the parent window. So it would be a Weston issue.I couldn't find the exact issue in its' issue tracker, so if it something really blocking you I suppose you can open an issue - though more research is probably needed to make a useful bug report. Otherwise, install a Windows X server and do X11 forwarding to the host.
-
Qt 6.8.0 on Linux (Ubuntu). Given:
QString message{ tr("Do you want to save the modifications?", "IDS_MSG_SAVEMODIFICATIONS") }; auto result = QMessageBox::question(this, "DeepSkyStacker", message, (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), QMessageBox::No);
I would expect the message box to be centered on the application or even the sub-window (this). However it appeared to be centered on the desktop.
What could I be doing wrong?
Thanks
Davidwrote on 18 Nov 2024, 15:53 last edited by@Perdrix
Are you running under Wayland by any chance? Default depends on your version of Ubuntu/desktop. Wayland compositor positions windows for you, and you can't tell it to do otherwise. Complain to Wayland people if you don't like it (lots of us don't). Plenty of posts to this effect of Wayland on this forum. -
wrote on 18 Nov 2024, 18:56 last edited by
Yes - it was running on WSL which uses Wayland - how to get their attention?
D.
-
wrote on 18 Nov 2024, 19:16 last edited by JonB
@Perdrix said in QMessageBox not centered on application:
how to get their attention?
LOL :) I gave up on Wayland because (a) it's no longer possible to resize MySQL Workbench application at all and (b) it makes desktop more or less unusable in VirtualBox due to serious screen tearing and mouse cursor overlay, the folks know about it but just say Wayland is not supported. So I have had to go back to Xorg, and thankfully don't worry about Wayland issues now.
-
@Perdrix
Are you running under Wayland by any chance? Default depends on your version of Ubuntu/desktop. Wayland compositor positions windows for you, and you can't tell it to do otherwise. Complain to Wayland people if you don't like it (lots of us don't). Plenty of posts to this effect of Wayland on this forum.wrote on 18 Nov 2024, 19:24 last edited by@JonB said in QMessageBox not centered on application:
Complain to Wayland people if you don't like it (lots of us don't)
But why is it like that?! I don't get it...
I don't know anyone who is like "Oh yeah, Wayland is great(er than all the Window Managers before)".
Maybe under the hood since it's more modern/newer but no being able to position windows?! Cmon... -
@JonB said in QMessageBox not centered on application:
Complain to Wayland people if you don't like it (lots of us don't)
But why is it like that?! I don't get it...
I don't know anyone who is like "Oh yeah, Wayland is great(er than all the Window Managers before)".
Maybe under the hood since it's more modern/newer but no being able to position windows?! Cmon...wrote on 18 Nov 2024, 19:44 last edited by JonB@Pl45m4
For my part I haven't seen anything to like in it. I think it may (well) be lighter weight than Xorg. That may be a big factor. There must be a good reason why Ubuntu/GNOME has gone default Wayland. It's not that you "can't" position your window, it's that its philosophy is that you're "not allowed" to do that, it chooses where to put desktop things. -
wrote on 20 Nov 2024, 09:34 last edited by
A not uninteresting distinction to make here is that Wayland does allow applications to position their surfaces relative to each other, but not globally. So a modal dialog being shown centered on its' parent window is something that the protocol allows (well, technically the
xdg-shell
extension protocol). Qt implements that, at least KDE respects that (just double checked that the expected behavior happens on KDE Wayland), Gnome appears to not respect that.I think Wayland has some good design decisions, but also some very bad ones, and the worst one IMO is that the roles of display server and window manager were combined into a single program (the compositor) so if you don't like a compositor's window management style but its' display server side is the one most integrated into the environment (i.e supports the needed graphics card or whatever) - though luck!
@Perdrix I don't know if it is possible in WSL, but I'd try to change the desktop environment from Gnome to KDE or something else (maybe DWL). Gnome is far too hostile to anything which does not fully subsribe to its' world view - which includes Gtk3/4 and libadwaita. Qt tries its' best, but it is often not enough.
-
wrote on 20 Nov 2024, 17:10 last edited by
This is offtopic but as a native Linux user the last time (about a year ago) I looked at migrating from X11 to Wayland everything was alpha quality with a ton of bugs cropping up everywhere. To be fair most things were advertised as such (missing features, plenty of bugs and sharp edges).
The old wisdom goes that "once you're 90% done you just need to take care of the other 90%" applies here.
To go from a hobbyist weekend project (which it is at the moment) to a product that just works is a relentless boring grind where one has no choice but to work through the bugs and missing features and fix the sharp edges.
The common problem in open source is that nobody wants to do this boring and inglorious grunt work so it's not done.
I estimate that it'll take another 20-30 years of slow maturing until Wayland is "ready".
-
wrote on 20 Nov 2024, 17:50 last edited by
Sad to say I am inclined to agree with you. I hate this "flavour du jour" thing that seems to happen a lot with Linux distros.
-
wrote on 20 Nov 2024, 18:14 last edited by JonB
As I wrote earlier, I have just reverted my Ubuntu 24.04 GNOME from its default Wayland to Xorg because of problems. I don't fully understand why Ubuntu considers Wayland ready to be the default since 22.04.
-
wrote on 20 Nov 2024, 21:45 last edited by IgKh
To try and help op progress, according to this the graphical system built into WSL uses the Weston compositor (not Gnome/Mutter), and it can't be (easily) replaced. I tried with a standalone Weston instance locally, and can reproduce the issue - the modal
QMessageBox
just pop ups at a random location each time, while under KWin it always opens centered in the parent window. So it would be a Weston issue.I couldn't find the exact issue in its' issue tracker, so if it something really blocking you I suppose you can open an issue - though more research is probably needed to make a useful bug report. Otherwise, install a Windows X server and do X11 forwarding to the host.
-
-
wrote on 21 Nov 2024, 04:55 last edited by
For various reasons I've trashed WSL, so this is no longer an issue :) I've installed an Lubuntu 22.04 build VM
-
For various reasons I've trashed WSL, so this is no longer an issue :) I've installed an Lubuntu 22.04 build VM
-
wrote on 22 Nov 2024, 02:15 last edited by Perdrix
WSL was Hyper-V. Lubuntu install is in VMware Workstation
1/15