[Qt-interest] obtaining application window from QApplicationinstance

Scott Aron Bloom Scott.Bloom at onshorecs.com
Fri Nov 12 18:29:09 CET 2010


The easiest way, derive from QApplication, and store the main windows
pointer.

 

This is out most singleton application systems work, you tell the system
wht the activation window is

Scott

 

From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Karel Bassez
Sent: Friday, November 12, 2010 9:20 AM
To: Girish Ramakrishnan
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] obtaining application window from
QApplicationinstance

 

As far as I can see, there's no need for another way anyhow.

On Fri, Nov 12, 2010 at 6:14 PM, Girish Ramakrishnan
<girish at forwardbias.in> wrote:

Hi Giacomo, 

If you have only one application window just store that instance in a
global variable (just like qApp) or if you don't like that provide a
MainWindow::instance() that provides the MainWindow instance.

 

topLevelWidgets returns all sorts of windows - even those that are
internal to Qt too. You can run through the list and
qobject_cast<MainWindow *>. 

 

There is no other way.

Girish

 

On Fri, Nov 12, 2010 at 2:58 PM, Giacomo S.
<giacomo.strangolino at elettra.trieste.it> wrote:

Hi to all.

I would like to know how to retrieve the application window (if
possible) from the QApplication instance.

tried with topLevelWidgets() but in the case of a QMainWindow also
toolbar menus and actions are returned, which is not what I want...

what I need to do is to raise the window of a running application when a
particular message is received through dbus, in order to make it appear
on the desktop when it is iconified or below other windows.

Thanks in advance.

Giacomo

Elettra - Synchrotron Radiation Facility

Trieste, Italy.

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

 


_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




-- 
Karel Bassez
Software Engineer
Vienna Symphonic Library GmbH

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101112/98d4ad84/attachment.html 


More information about the Qt-interest-old mailing list