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. What can I do for my QtWidget-Program's Window correctly positioned on the screen?
Forum Updated to NodeBB v4.3 + New Features

What can I do for my QtWidget-Program's Window correctly positioned on the screen?

Scheduled Pinned Locked Moved Unsolved General and Desktop
45 Posts 8 Posters 8.3k Views 3 Watching
  • 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.
  • foghere2023F Offline
    foghere2023F Offline
    foghere2023
    wrote on last edited by
    #17

    Can someone help me?

    1 Reply Last reply
    0
    • JonBJ JonB referenced this topic on
    • foghere2023F Offline
      foghere2023F Offline
      foghere2023
      wrote on last edited by
      #18

      Looking forward to friends repeating this bug

      SGaistS 1 Reply Last reply
      0
      • foghere2023F foghere2023

        Looking forward to friends repeating this bug

        SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #19

        @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.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        JonBJ foghere2023F 2 Replies Last reply
        2
        • SGaistS SGaist

          @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.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #20

          @SGaist said in What can I do for my QtWidget-Program's Window correctly positioned on the screen?:

          As for your issue, the Wayland specification is explicit, windows cannot move themselves around the desktop.

          Thank you for this :)

          1 Reply Last reply
          0
          • foghere2023F foghere2023

            @JoeCFD

            I had find this post,And I don't know what is weston.

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #21

            @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

            1 Reply Last reply
            0
            • foghere2023F foghere2023

              @JoeCFD

              I had find this post,And I don't know what is weston.

              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by JoeCFD
              #22

              @foghere2023
              Two solutions in that post:

              1. Replace weston with Qtwayland compositor
              2. 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

              JonBJ 1 Reply Last reply
              0
              • SGaistS SGaist

                @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.

                foghere2023F Offline
                foghere2023F Offline
                foghere2023
                wrote on last edited by
                #23

                @SGaist @JoeCFD

                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

                alt text

                JoeCFDJ 1 Reply Last reply
                0
                • foghere2023F foghere2023

                  @SGaist @JoeCFD

                  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

                  alt text

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by
                  #24

                  @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.

                  foghere2023F 1 Reply Last reply
                  0
                  • JoeCFDJ JoeCFD

                    @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.

                    foghere2023F Offline
                    foghere2023F Offline
                    foghere2023
                    wrote on last edited by
                    #25

                    @JoeCFD Thank you friend,I have read that post,but I don't know how to do.

                    1 Reply Last reply
                    0
                    • JoeCFDJ JoeCFD

                      @foghere2023
                      Two solutions in that post:

                      1. Replace weston with Qtwayland compositor
                      2. 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

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #26

                      @foghere2023

                      but I don't know how to do.

                      @JoeCFD said:

                      Two solutions in that post:

                      1. Replace weston with Qtwayland compositor
                      2. 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?

                      foghere2023F 1 Reply Last reply
                      0
                      • JonBJ JonB

                        @foghere2023

                        but I don't know how to do.

                        @JoeCFD said:

                        Two solutions in that post:

                        1. Replace weston with Qtwayland compositor
                        2. 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?

                        foghere2023F Offline
                        foghere2023F Offline
                        foghere2023
                        wrote on last edited by
                        #27

                        @JonB @SGaist @JoeCFD

                        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

                        JonBJ 1 Reply Last reply
                        0
                        • foghere2023F foghere2023

                          @JonB @SGaist @JoeCFD

                          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

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #28

                          @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....

                          foghere2023F 1 Reply Last reply
                          1
                          • JonBJ JonB

                            @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....

                            foghere2023F Offline
                            foghere2023F Offline
                            foghere2023
                            wrote on last edited by foghere2023
                            #29

                            @JonB

                            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.

                            jsulmJ 1 Reply Last reply
                            0
                            • foghere2023F foghere2023

                              @JonB

                              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.

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by jsulm
                              #30

                              @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 @JoeCFD

                              1. Replace weston with Qtwayland compositor
                              2. Don't use wayland at all, but use the eglfs platform plugin.
                              

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              foghere2023F 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @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 @JoeCFD

                                1. Replace weston with Qtwayland compositor
                                2. Don't use wayland at all, but use the eglfs platform plugin.
                                
                                foghere2023F Offline
                                foghere2023F Offline
                                foghere2023
                                wrote on last edited by foghere2023
                                #31

                                @jsulm thank you, but I don't konw what is ' Replace weston with Qtwayland compositor ':

                                this is a Demo,it is very simple, only a line sentence to delimit a popup message

                                https://github.com/cppxiaozhu/Demo

                                Where is ' weston ' ,and how to 'Replace weston with Qtwayland compositor' ?

                                On these most basic things, I can't figure it out.

                                JoeCFDJ 1 Reply Last reply
                                0
                                • foghere2023F foghere2023

                                  @jsulm thank you, but I don't konw what is ' Replace weston with Qtwayland compositor ':

                                  this is a Demo,it is very simple, only a line sentence to delimit a popup message

                                  https://github.com/cppxiaozhu/Demo

                                  Where is ' weston ' ,and how to 'Replace weston with Qtwayland compositor' ?

                                  On these most basic things, I can't figure it out.

                                  JoeCFDJ Offline
                                  JoeCFDJ Offline
                                  JoeCFD
                                  wrote on last edited by JoeCFD
                                  #32

                                  @foghere2023 https://www.youtube.com/watch?v=mIg1P3i2ZfI
                                  I guess the default compositor on Wayland is weston. What you need to do is to replace it with Qtwayland compositor.
                                  Turn weston off and turn Qtwayland compositor on.
                                  Watch the video above and you may get some ideas.

                                  foghere2023F 1 Reply Last reply
                                  0
                                  • JoeCFDJ JoeCFD

                                    @foghere2023 https://www.youtube.com/watch?v=mIg1P3i2ZfI
                                    I guess the default compositor on Wayland is weston. What you need to do is to replace it with Qtwayland compositor.
                                    Turn weston off and turn Qtwayland compositor on.
                                    Watch the video above and you may get some ideas.

                                    foghere2023F Offline
                                    foghere2023F Offline
                                    foghere2023
                                    wrote on last edited by
                                    #33

                                    @JoeCFD

                                    thank you very much,

                                    but I had watch that Video several days ago, the Video show us How to create a new Class by Qtwayland compositor with QML.

                                    so I think maybe I need refactor all UI-Class such as QMessageBox or QDialog,This challenge is too difficult for me.

                                    in my ubuntu22.04-lts,the wayland compositor is Xwayland.

                                    my friend, your suggested「Turn weston off and turn Qtwayland compositor on」is mean I need do something with my Qtcreator or My PC system?

                                    for example,what should I do in this Demo?

                                    https://github.com/cppxiaozhu/Demo

                                    If it is only for the correct position of the message prompt window of the compiled APP, then it is the easiest way to let their users no longer use the wayland desktop.

                                    But I'm trying to do something to adapt this program to the wayland desktop.

                                    I'm very depressed now because you guys say it's a wayland bug, and considering wayland's slow update mechanism, I don't think I'll see a solution in my lifetime.

                                    As far as I know, the time it takes for wayland to fix some of its inherent problems needs to be counted in decades.

                                    I've tried my best to find information, but almost none of them are particularly detailed.

                                    alt text1

                                    alt text2

                                    JoeCFDJ 1 Reply Last reply
                                    0
                                    • foghere2023F foghere2023

                                      @JoeCFD

                                      thank you very much,

                                      but I had watch that Video several days ago, the Video show us How to create a new Class by Qtwayland compositor with QML.

                                      so I think maybe I need refactor all UI-Class such as QMessageBox or QDialog,This challenge is too difficult for me.

                                      in my ubuntu22.04-lts,the wayland compositor is Xwayland.

                                      my friend, your suggested「Turn weston off and turn Qtwayland compositor on」is mean I need do something with my Qtcreator or My PC system?

                                      for example,what should I do in this Demo?

                                      https://github.com/cppxiaozhu/Demo

                                      If it is only for the correct position of the message prompt window of the compiled APP, then it is the easiest way to let their users no longer use the wayland desktop.

                                      But I'm trying to do something to adapt this program to the wayland desktop.

                                      I'm very depressed now because you guys say it's a wayland bug, and considering wayland's slow update mechanism, I don't think I'll see a solution in my lifetime.

                                      As far as I know, the time it takes for wayland to fix some of its inherent problems needs to be counted in decades.

                                      I've tried my best to find information, but almost none of them are particularly detailed.

                                      alt text1

                                      alt text2

                                      JoeCFDJ Offline
                                      JoeCFDJ Offline
                                      JoeCFD
                                      wrote on last edited by
                                      #34

                                      @foghere2023 I do not have an answer for you now. But I will take a look at it later.

                                      foghere2023F 1 Reply Last reply
                                      0
                                      • JoeCFDJ JoeCFD

                                        @foghere2023 I do not have an answer for you now. But I will take a look at it later.

                                        foghere2023F Offline
                                        foghere2023F Offline
                                        foghere2023
                                        wrote on last edited by
                                        #35

                                        @JoeCFD thank you

                                        1 Reply Last reply
                                        0
                                        • foghere2023F Offline
                                          foghere2023F Offline
                                          foghere2023
                                          wrote on last edited by
                                          #36

                                          After a long time, the problem remains unsolved.

                                          Christian EhrlicherC 1 Reply Last reply
                                          0

                                          • Login

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