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 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
            • foghere2023F foghere2023

              After a long time, the problem remains unsolved.

              Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #37

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

              After a long time, the problem remains unsolved.

              I don't think it's the correct place here when you want wayland improvements.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              foghere2023F 1 Reply Last reply
              1
              • Christian EhrlicherC Christian Ehrlicher

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

                After a long time, the problem remains unsolved.

                I don't think it's the correct place here when you want wayland improvements.

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

                @Christian-Ehrlicher

                It's a pity that qwidget can't adapt to the new changes brought by wayland.

                1 Reply Last reply
                0
                • posktomtenP Offline
                  posktomtenP Offline
                  posktomten
                  wrote on last edited by
                  #39

                  Maybe a workaround?

                  QMessageBox mMessageBox;
                  int x = this->x();
                  int y = this->y();
                  mMessageBox.setGeometry(x,y,300,100);
                  

                  posktomten

                  foghere2023F 3 Replies Last reply
                  0
                  • posktomtenP posktomten

                    Maybe a workaround?

                    QMessageBox mMessageBox;
                    int x = this->x();
                    int y = this->y();
                    mMessageBox.setGeometry(x,y,300,100);
                    
                    foghere2023F Offline
                    foghere2023F Offline
                    foghere2023
                    wrote on last edited by
                    #40

                    @posktomten

                    thank you , but it doesn't work,the Dialog cannot move itself to by 'move' func ,somebody says that wayland not provide coordinate data

                    1 Reply Last reply
                    0
                    • posktomtenP posktomten

                      Maybe a workaround?

                      QMessageBox mMessageBox;
                      int x = this->x();
                      int y = this->y();
                      mMessageBox.setGeometry(x,y,300,100);
                      
                      foghere2023F Offline
                      foghere2023F Offline
                      foghere2023
                      wrote on last edited by
                      #41

                      @posktomten

                      someone tell me :『Wayland does not support manual positioning』

                      1 Reply Last reply
                      0
                      • posktomtenP posktomten

                        Maybe a workaround?

                        QMessageBox mMessageBox;
                        int x = this->x();
                        int y = this->y();
                        mMessageBox.setGeometry(x,y,300,100);
                        
                        foghere2023F Offline
                        foghere2023F Offline
                        foghere2023
                        wrote on last edited by foghere2023
                        #42

                        @posktomten

                            int x = this->geometry().x();
                            int y = this->geometry().y();  
                            qDebug() << "Window position: (" << x << ", " << y << ")";
                        

                        the 「window position」is (0,0) forever

                        posktomtenP 1 Reply Last reply
                        0
                        • foghere2023F foghere2023

                          @posktomten

                              int x = this->geometry().x();
                              int y = this->geometry().y();  
                              qDebug() << "Window position: (" << x << ", " << y << ")";
                          

                          the 「window position」is (0,0) forever

                          posktomtenP Offline
                          posktomtenP Offline
                          posktomten
                          wrote on last edited by
                          #43

                          @foghere2023 Yes thank you! I apologize. I should have checked better.

                          posktomten

                          foghere2023F 1 Reply Last reply
                          0
                          • posktomtenP posktomten

                            @foghere2023 Yes thank you! I apologize. I should have checked better.

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

                            @posktomten

                            now,just use xcb like this for wayland user『QT_QPA_PLATFORM=xcb ./testApp』

                            Seb TurS 1 Reply Last reply
                            0
                            • foghere2023F foghere2023

                              @posktomten

                              now,just use xcb like this for wayland user『QT_QPA_PLATFORM=xcb ./testApp』

                              Seb TurS Offline
                              Seb TurS Offline
                              Seb Tur
                              wrote on last edited by
                              #45

                              @foghere2023
                              thanks for the tip , mid 2024 and the issue is still here with wayland

                              1 Reply Last reply
                              1

                              • Login

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