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. Position of QMessageBox : centered on screen
Qt 6.11 is out! See what's new in the release blog

Position of QMessageBox : centered on screen

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.9k 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.
  • B Offline
    B Offline
    boelraty
    wrote on last edited by
    #1

    Hi,

    I'm using a QMessageBox inside a Widget. The object is build during main widget constructor and I'm using slots to show/hide the QMessageBox.
    I'm experiencing trouble with the QMessageBox position. The first time "show" is called, the box is well centered. Next time, the box is moved to the top left of the screen and move / setGeometry methods don't work to replace it at widget center.

    How can I keep my box on screen center ?

    Thank you. Best.

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      The QMEssagebox is always centered on the parent. The first time the parent is probably set correctly. How it reacts after that is a mystery to me, I never show/hide a QMessageBox, but only create one within a certain scope with modal set (blocking all other inputs to the program) and then when the user clicks a button/closes the messagebox the QMessageBox goes out of scope, releasing it's memory.

      Greetz, Jeroen

      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