Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, March 2007
Raise another QMainWindow


Message 1 in thread

Hi Everyone,
I have two QMainWindow. Let's say window A and window B.
In window A, I have a menu action needs to "raise" window B
to the front.

But I called window B QMainWindow::raise and QMainWindow::setFocus.
It raised and bring to front no doubt. But the active window is still
window A. I mean "active" is the window title bar is blue under Window
XP environment.

I also tried :

        QApplication::setActiveWindow(m_pWindowB);
        m_pWindowB->activateWindow();

But they all not working.

Please help me out.

Thanks.

Regards,
Pagan



--
 [ signature omitted ] 

Message 2 in thread

Hi Pagan:

Pagan Chou wrote:
> But I called window B QMainWindow::raise and QMainWindow::setFocus.
> It raised and bring to front no doubt. But the active window is still
> window A. I mean "active" is the window title bar is blue under Window
> XP environment.

I had a similar problem some time ago. I remember that after some 
experimenting (probably the same stuff that you've tried) I concluded 
that my window could not be brought to foreground using Qt. That was 
with Qt3.3.5, so things might have changed since then.

I've ended up using the Win32 SetForegroundWindow function that solved 
this specifically for Windows.

Hey ... I've just noticed in the documentation of SetForegroundWindow 
that this function will not work on Windows 2000/XP if a menu is 
active. Could it be that an active menu is preventing Qt from raising 
the window in your case?

Martin.

--
 [ signature omitted ]