Results 1 to 2 of 2

Thread: Making sure dialogs and messageboxes pop up at the center of the screen

  1. #1
    Join Date
    Sep 2012
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Making sure dialogs and messageboxes pop up at the center of the screen

    Hello,

    In my application however a user might frequently switch between tabs while a process within the application goes on. After the process is over a messagebox displays the information however every time the mainwindow loses focus i.e the user is on another application the message box appears in the top-left corner of the screen.


    I know people have asked how to center dialog boxes to the center of the screen. But is there a way to make the message box appear in the center of the screen always instead of the top left corner.


    void displayMessage(const char *text, QMessageBox::Icon icon)
    {
    QMessageBox message;
    message.setIcon(icon);
    message.setText(text);
    message.exec();
    }


    Thanks

    Kedar

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Making sure dialogs and messageboxes pop up at the center of the screen

    Does it change anything if you use static methods of QMessageBox?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to center main window on screen?
    By LarryP in forum Qt Programming
    Replies: 5
    Last Post: 24th July 2020, 20:29
  2. how to show window in the center of the screen?
    By lovelypp in forum Qt Programming
    Replies: 5
    Last Post: 18th March 2014, 21:43
  3. how to put a dialog in the center of the screen
    By biswajithit in forum Qt Programming
    Replies: 4
    Last Post: 4th September 2008, 12:24
  4. Show dialog in screen center
    By mourad in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2008, 13:41
  5. screen number and modal dialogs
    By high_flyer in forum Qt Programming
    Replies: 18
    Last Post: 22nd June 2007, 18:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.