Results 1 to 3 of 3

Thread: [SOLVED] QWidget - how to bring it to front if parent is NULL?

  1. #1
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    1

    Question [SOLVED] QWidget - how to bring it to front if parent is NULL?

    Hello everyone.

    Here is the problem:

    In my application I have one MainWindow and one widget, the widget is created dynamically by something like this:

    Qt Code:
    1. if(fo)
    2. {
    3. fo->show();
    4. }
    5. else
    6. {
    7. fo=new filterOptions(&ut,&lt,&maxDifference,&maxAngleDifference,
    8. &checkDistance,&checkAngle);
    9. fo->setAttribute(Qt::WA_DeleteOnClose);
    10. fo->show();
    11. }
    To copy to clipboard, switch view to plain text mode 

    It works OK, but I want it to bring the widget window to front, if it is behind mainWindow (which is maximized), how can I do that? show() doesn't seem to work for parentless windows.

    Thanks in advance for the answers.
    Last edited by Huk; 29th May 2011 at 13:58.

  2. #2
    Join Date
    Aug 2008
    Posts
    45
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget - how to bring it to front if parent is NULL?

    Try QWidget::activateWindow() or QWidget::raise().

  3. #3
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    1

    Default Re: QWidget - how to bring it to front if parent is NULL?

    @joyer83:

    Thank you very much

    activateWindow() seem to work.

Similar Threads

  1. Bring application window to front
    By St@n in forum Qt Programming
    Replies: 13
    Last Post: 5th July 2019, 01:55
  2. Bring window to the front
    By Barry79 in forum Newbie
    Replies: 2
    Last Post: 14th August 2009, 17:50
  3. Bring QDialog to front
    By mitro in forum Newbie
    Replies: 3
    Last Post: 21st April 2008, 20:32
  4. Qt3 Bring to front application
    By nleverin in forum Qt Programming
    Replies: 1
    Last Post: 7th February 2008, 11:27
  5. How to bring a dialogbox to the front?
    By bood in forum Qt Programming
    Replies: 2
    Last Post: 2nd August 2006, 15:04

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.