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. QT Window not centering.
Qt 6.11 is out! See what's new in the release blog

QT Window not centering.

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 236 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.
  • E Offline
    E Offline
    elitsa
    wrote last edited by
    #1

    Is there a possibility to center a window in QT without it being overwritten by the OS. I have ab application that swaps windows and every window appears on different random coordinates on my screen. I would like to center all of them. I have tried everything I saw online such as setGeometry(), overwritting showEvent(), adjusting screeen width/height, using QDesktopWidget etc. None of these work for me.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      elitsa
      wrote last edited by
      #2

      I forgot to mention I am working on PyQt6 with exact version 6.4.2.2.3

      Christian EhrlicherC 1 Reply Last reply
      0
      • E elitsa

        I forgot to mention I am working on PyQt6 with exact version 6.4.2.2.3

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote last edited by
        #3

        @elitsa said in QT Window not centering.:

        am working on PyQt6 with exact version 6.4.2.2.3

        On Wayland?

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

        1 Reply Last reply
        2
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote last edited by
          #4

          As @Christian-Ehrlicher was seemingly pointing in this direction, wayland has taken it upon itself to decide that clients are not special enough to manager their own layout locations...it's connected to some kind of a paranoid security concept...Yet another in a line of reasons I won't use a wayland backed display.

          The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

          1 Reply Last reply
          2
          • E Offline
            E Offline
            elitsa
            wrote last edited by
            #5

            Thank you both @Christian-Ehrlicher , @Kent-Dorfman ! I changed it and now it no longer runs on Wayland and it renders in the middle :)) This was so helpful! Thanks again!

            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