PDA

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



Huk
29th May 2011, 13:41
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:



if(fo)
{
fo->show();
}
else
{
fo=new filterOptions(&ut,&lt,&maxDifference,&maxAngleDifference,
&checkDistance,&checkAngle);
fo->setAttribute(Qt::WA_DeleteOnClose);
fo->show();
}


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.

joyer83
29th May 2011, 13:47
Try QWidget::activateWindow() or QWidget::raise().

Huk
29th May 2011, 14:58
@joyer83:

Thank you very much :)

activateWindow() seem to work.