[Interest] Find frontmost widget of specific type?

Israel Brewster ibrewster at flyravn.com
Mon Oct 22 20:37:56 CEST 2018


I have an application (Qt 5.9) that has a variety of different types of windows you can open. If a user selects to open a type of window that is already open, I want to position the new window relative to the existing one. I can easily find any existing windows of a given type by going through the list of widgets in QApplication::allWidgets(), doing a qobject_cast to the proper type, and checking the result, but is there a way to determine which of these is the frontmost of that type? QApplication::ActiveWindow() doesn't help, because the activeWindow may not be of that type.

-----------------------------------------------
Israel Brewster
Systems Analyst II
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
-----------------------------------------------

[cid:6da0fc9b-4232-4d70-8cd7-9f8212508c1a at flyravn.com]



[cid:fd4128fd-46d2-40d0-a243-a2cd24dfd361 at flyravn.com]







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181022/a5dff74e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 2298 bytes
Desc: image001.jpg
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181022/a5dff74e/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 6246 bytes
Desc: image002.jpg
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181022/a5dff74e/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Israel Brewster.vcf
Type: text/directory
Size: 417 bytes
Desc: Israel Brewster.vcf
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181022/a5dff74e/attachment.bin>


More information about the Interest mailing list