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. Can't move window to center of screen.
Qt 6.11 is out! See what's new in the release blog

Can't move window to center of screen.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 633 Views 2 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.
  • V Offline
    V Offline
    Vad_i
    wrote on last edited by
    #1

    I've seen a way online to get the coordinates for the center of the screen, and at the end, it calls the move function to move it to the relevant coordinates. My move function does not do anything, and I don't see anyone else online having the same issue.

    I'm using Qt Creator. Here's the constructor for the first window.

    StartScreenWindow::StartScreenWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::StartScreenWindow)
    {
        ui->setupUi(this);
        this->move(900, 900);
    }
    

    The window still stays only at the top left. There are no errors. The only warning I have is "QSocketNotifier: Can only be used with threads started with QThread" which from what I found online is something wrong with a library and not for me to fix, so I don't think it's relevant.

    JonBJ 1 Reply Last reply
    0
    • V Vad_i

      I've seen a way online to get the coordinates for the center of the screen, and at the end, it calls the move function to move it to the relevant coordinates. My move function does not do anything, and I don't see anyone else online having the same issue.

      I'm using Qt Creator. Here's the constructor for the first window.

      StartScreenWindow::StartScreenWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::StartScreenWindow)
      {
          ui->setupUi(this);
          this->move(900, 900);
      }
      

      The window still stays only at the top left. There are no errors. The only warning I have is "QSocketNotifier: Can only be used with threads started with QThread" which from what I found online is something wrong with a library and not for me to fix, so I don't think it's relevant.

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

      @Vad_i What platform are you on? Are you running under Wayland?

      V 1 Reply Last reply
      0
      • JonBJ JonB

        @Vad_i What platform are you on? Are you running under Wayland?

        V Offline
        V Offline
        Vad_i
        wrote on last edited by
        #3

        @JonB Yes. I'm using Qt Creator on Fedora Linux. Does it not work with Wayland?

        JonBJ 1 Reply Last reply
        0
        • V Vad_i

          @JonB Yes. I'm using Qt Creator on Fedora Linux. Does it not work with Wayland?

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

          @Vad_i
          The gist is, Wayland, or at least the default compositor I think, does not allow window positioning. Period. You can search posts on this forum which end up to that effect. If you can test with X11 I imagine you'll find it works.

          V 1 Reply Last reply
          0
          • JonBJ JonB

            @Vad_i
            The gist is, Wayland, or at least the default compositor I think, does not allow window positioning. Period. You can search posts on this forum which end up to that effect. If you can test with X11 I imagine you'll find it works.

            V Offline
            V Offline
            Vad_i
            wrote on last edited by
            #5

            @JonB Unfortunate. Thank you very much.

            1 Reply Last reply
            0
            • V Vad_i has marked this topic as solved on

            • Login

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