[Qt-interest] obtaining application window from QApplication instance

Karel Bassez bassez.karel at gmail.com
Fri Nov 12 18:20:06 CET 2010


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/0c8f5c62/attachment.html 


More information about the Qt-interest-old mailing list