tags:

views:

192

answers:

1

My QT app has multiple windows and sometimes, even though the windows are already open but burried under other windows, the user will select an option to open one from the mainwindow menubar in which case I want to simply bring it up and make it the current one. Now using QWidget->raise makes this window go on top of all other windows but it doesnt select it and that is what I need to do. I tried QWidget->setFocus but that doesnt do anything. In the mean time I am using a combination of QWidget->close followed by QWidget->show but I would like to know if there is a command to use with ->raise.

I tried:

        pMission->raise();
        pMission->setFocus(Qt::ActiveWindowFocusReason);

but it didnt work so i used:

        pMission->close();
        pMission->show();
+3  A: 

Have you ever tried QWidget::activateWindow?

From help file, this function is going to

Sets the top-level widget containing this widget to be the active window. An active window is a visible top-level window that has the keyboard input focus.

Mason Chang