What can I do for my QtWidget-Program's Window correctly positioned on the screen?
-
@foghere2023
See if it works under Xorg?
If so wait for it to work under Wayland at a future date, assuming it can? -
@JonB thank you guys, it works very well under Xorg,and I have test a simple Demo like is :
void MainWindow::on_pushButton_clicked() { QMessageBox::information(this,"提示消息","已成功读档!"); }
This Demo only have one line of command here for QMessageBox , I have spent all day for the workaround,I don't know this is my false or Qt-team‘s. :(
as your piont ,this is not my false ?
-
@foghere2023 hi,
It's neither. See the Wayland doc.
-
@SGaist So guys,Reading the docs is just too difficult for me, someone tell me to wait, because there is a day that Qwidget App's Popups and parent windows can locate correctly .
Is there any way we can get the program to work now?
-
Can someone help me?
-
Looking forward to friends repeating this bug
-
@foghere2023 please show some patience and allow at least 24 hours to pass before bumping your own thread. This is a voluntary driven forum and people may not live in the same timezone as you.
Weston is the reference implementation of a Wayland compositor.
As for your issue, the Wayland specification is explicit, windows cannot move themselves around the desktop.
-
@foghere2023 said in What can I do for my QtWidget-Program's Window correctly positioned on the screen?:
weston
Weston is the reference implementation of a Wayland compositor, as well as a useful environment in and of itself.
You can easily create a customized widget to replace it. Make your mainwindow to be its parent and it will always pop-up on top of main window.
The source code is here and you can borrow some
https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/dialogs/qmessagebox.cpp?h=dev -
@foghere2023
Two solutions in that post:- Replace weston with Qtwayland compositor
- Don't use wayland at all, but use the eglfs platform plugin.
You may not be able to select 2. Then try solution 1.
The side effect is you can't use g2d rendering. If you do not have issues with it, then go with it. Find out how to replace weston with Qtwayland compositor -
My friends, I may not have accurately described my problem, so that you did not understand what happened here. I didn't want to move the window, but the message pop-up window appeared in the wrong place.
this is a Demo:
https://github.com/cppxiaozhu/Demo
-
@foghere2023 The post in the link had the exactly same problem.
The QDialog default position should locate at centered on top of the parent's top-level widget.
But QDialog in Wayland shows on a random position. -
but I don't know how to do.
@JoeCFD said:
Two solutions in that post:
- Replace weston with Qtwayland compositor
- Don't use wayland at all, but use the eglfs platform plugin.
You may not be able to select 2. Then try solution 1.
If that is what @JoeCFD are the alternatives then have you tried either of them?
-
Hi friend,this is a simple Demo,could you show me how to improve or repair this issue ?
https://github.com/cppxiaozhu/Demo
I really want to fix this problem, but there is no example to learn.
The compilation environment I use is a binary version downloaded from the QT official website. Now almost all Linux distributions have defaulted to the wayland environment, and the official tools of QT cannot adapt to this new situation. I sincerely hope that someone can seriously deal with
the Bug that can be reproduced in one line of code -
@foghere2023
You simply keep saying you don't know what to do and asking for help. We know it's know in the place you want. We know what your code is. We have said this is a Wayland issue, there is no more to ask about.Let us know when you have tried, say, @JoeCFD's suggestions....
-
Thank you for your patient explanation,
but the matter of refactoring wedgit is limited by my skills, and I can't solve it by myself.
I hope someone can give an example that can be used for reference.
Of course, it would be even better if the organization that promotes wayland or the Qt official can fix this problem.
I've been looking for discussions on the internet these days, but it's very strange to find so few people suffering from this problem.
-
@foghere2023 said in What can I do for my QtWidget-Program's Window correctly positioned on the screen?:
but the matter of refactoring wedgit
The suggestion was not to refactor anything.
This was suggested by @JoeCFD1. Replace weston with Qtwayland compositor 2. Don't use wayland at all, but use the eglfs platform plugin.