Results 1 to 4 of 4

Thread: Show in center

  1. #1
    Join Date
    Nov 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Post Show in center

    How to open dialog in center relative a widget in a parent dialog ? I have a tabwidget in a Dialog. Every time me open other dialog, the other dialog will show on center tabwidget. Not center on parent dialog. I have use this code. But not work

    Qt Code:
    1. OtherDlg *d=new OtherDlg(ui->tabWidget);
    2. d->exec();
    To copy to clipboard, switch view to plain text mode 

    Btw, sorry with my english..

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Show in center

    If you want to show dialog in a center of some widget then pass a pointer to that widget as a parent. I assume this should work:
    Qt Code:
    1. OtherDlg *d=new OtherDlg(this);
    2. d->exec()
    To copy to clipboard, switch view to plain text mode 
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. #3
    Join Date
    Nov 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Show in center

    Yes. But dialog will show in a center parent dialog. Not center in widget (tabWidget) on parent dialog.

  4. #4
    Join Date
    Jul 2009
    Location
    Italy, Pieve Ligure (GE)
    Posts
    55
    Thanks
    7
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Show in center

    Quote Originally Posted by lisa View Post
    Yes. But dialog will show in a center parent dialog. Not center in widget (tabWidget) on parent dialog.
    Then I would try:
    Qt Code:
    1. OtherDlg *d=new OtherDlg(ui->tabWidget);
    2. d->exec()
    To copy to clipboard, switch view to plain text mode 
    I didn't try, so I'm not sure, but it is simple to test, isn't it?

    M.

Similar Threads

  1. 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
  2. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  3. problem with show Chinese
    By osmanthus in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 02:49
  4. Show dialog in screen center
    By mourad in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2008, 13:41
  5. How to show custom widget in TreeView's cell :-/
    By WolfMM in forum Qt Programming
    Replies: 2
    Last Post: 7th July 2007, 11:16

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.