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. [SOLVED] How to ensure that a dialog always appears at center of the screen
Qt 6.11 is out! See what's new in the release blog

[SOLVED] How to ensure that a dialog always appears at center of the screen

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.2k Views 1 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.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

    Whenever i invoke the dialog, main application being hidden, the dialog appears at corner.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      You can simply set geometry for your Dialog to the center of the screen...

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        broadpeak
        wrote on last edited by
        #3

        For example:

        @
        Dialog::Dialog(QWidget *parent) : QDialog(parent)
        {
        const QRect screen = QApplication::desktop()->screenGeometry();
        this->move( screen.center() - this->rect().center() );
        }
        @

        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