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

Qt-interest Archive, December 2006
Force window to be in foreground


Message 1 in thread

Hi,

The qt-docs say that it's not possible to bring a window to front of the 
desktop if another application has the focus / is in foreground under windows 
but I wonder whether there's really no solution for that... Does anybody know 
how to bring qt-toplevel-widgets to front? Windows-specific-code is accetable 
too. I really need that...

Furthermore I need "desktop"-modal dialogs, i.e. such dialogs which can't be 
put in background by switching to another window and which first have to be 
closed by pressing ok or similiar. Any idea?

toby

Attachment:

Attachment: pgpmRKJ2Q7l70.pgp
Description: PGP signature


Message 2 in thread

Do the following.

First, for the parent window of the modal dialog, do the following:
win->show();
win->raise();
win->activateWindow()


Then create a normal dialog

Dlg dlg( win );
dlg.exec();

Scott



> -----Original Message-----
> From: Tobias Doerffel [mailto:tobias.doerffel@xxxxxxxxx]
> Sent: Saturday, December 09, 2006 5:41 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Force window to be in foreground
> 
> Hi,
> 
> The qt-docs say that it's not possible to bring a window to front of
the
> desktop if another application has the focus / is in foreground under
> windows
> but I wonder whether there's really no solution for that... Does
anybody
> know
> how to bring qt-toplevel-widgets to front? Windows-specific-code is
> accetable
> too. I really need that...
> 
> Furthermore I need "desktop"-modal dialogs, i.e. such dialogs which
can't
> be
> put in background by switching to another window and which first have
to
> be
> closed by pressing ok or similiar. Any idea?
> 
> toby

--
 [ signature omitted ] 

Message 3 in thread

Am Sonntag, 10. Dezember 2006 07:07 schrieb Scott Aron Bloom:
> First, for the parent window of the modal dialog, do the following:
> win->show();
> win->raise();
> win->activateWindow()
In my case I do not have a main-window. I just need to display several windows 
(such as messageboxes) from time to time (it's a system-service waiting for 
requests on a socket). The thing you've explained (show(), raise, 
activateWindow()) is what I already tried with my dialogs but it doesn't work 
always... :-(

toby

Attachment:

Attachment: pgpDU7OElTeAc.pgp
Description: PGP signature


Message 4 in thread

On 12/10/06, Tobias Doerffel <tobias.doerffel@xxxxxxxxx> wrote:
> Am Sonntag, 10. Dezember 2006 07:07 schrieb Scott Aron Bloom:
> > First, for the parent window of the modal dialog, do the following:
> > win->show();
> > win->raise();
> > win->activateWindow()
> In my case I do not have a main-window. I just need to display several windows
> (such as messageboxes) from time to time (it's a system-service waiting for
> requests on a socket). The thing you've explained (show(), raise,
> activateWindow()) is what I already tried with my dialogs but it doesn't work
> always... :-(

My overloaded activateWindow looks like this.

    QWidget::activateWindow();
    raise();
#if defined( Q_OS_WIN )
    SetWindowPos( winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
    SetWindowPos( winId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE |
SWP_NOSIZE );
#endif

-- 
 [ signature omitted ]