Re: [Interest] Find frontmost widget of specific type?

2018-10-22 Thread Henry Skoglund

On 22/10/2018 23.34, Giuseppe D'Angelo via Interest wrote:

Il 22/10/18 23:22, Henry Skoglund ha scritto:

Hi, just an idea, but obviously somewhere deep inside Qt's bowels
(rather, the painting system) there's knowledge of which window obscures
which etc.


There isn't. Compositing window managers have been a reality on desktop 
machines since Mac OS X 10.2 (2002), maybe even before that.


The only really robust approach is asking the WM what are the visible 
windows and their stacking order. Keeping the order in Qt is also 
feasable, modulo of course bugs in the Qt / WM interaction...


My 2 c,



Ok, I see, nice try but 16 years too late. I guess that only shows my 
age :-(


Rgds Henry

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Find frontmost widget of specific type?

2018-10-22 Thread Giuseppe D'Angelo via Interest

Il 22/10/18 23:22, Henry Skoglund ha scritto:

Hi, just an idea, but obviously somewhere deep inside Qt's bowels
(rather, the painting system) there's knowledge of which window obscures
which etc.


There isn't. Compositing window managers have been a reality on desktop 
machines since Mac OS X 10.2 (2002), maybe even before that.


The only really robust approach is asking the WM what are the visible 
windows and their stacking order. Keeping the order in Qt is also 
feasable, modulo of course bugs in the Qt / WM interaction...


My 2 c,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Find frontmost widget of specific type?

2018-10-22 Thread Henry Skoglund

On 22/10/2018 22.37, John Weeks wrote:

We faced pretty much exactly this issue when we ported our very large 
application to Qt, starting with Qt 4.8. We have many places where we expect to 
be able to walk a window list in Z order. I wound up using Activate/Deactivate 
events to keep the list myself. I can't really recommend it- it has been pretty 
much of a nightmare to make it robust and bug-free, especially as Qt has a 
couple of bugs in their own notion of window activation. You can't really use 
the debugger to debug these issues, as the activation of the debugger changes 
the activation of the application's windows.

I have made it work pretty well, but I quake in my boots whenever I get a bug 
report about window order.

We are now using Qt 5.9 and don't have any sort of replacement for my delicate 
and difficult code.

-John Weeks
WaveMetrics, Inc.


On Oct 22, 2018, at 11:37 AM, Israel Brewster  wrote:

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.




Hi, just an idea, but obviously somewhere deep inside Qt's bowels 
(rather, the painting system) there's knowledge of which window obscures 
which etc.


Say you issue a dummy QWidget::update() on your topmost/app window, then 
catches all the QPaintEvents that are called. Inside those QPaintEvents 
is a QPaintEvent::rect() that holds the rectangle that needs to be 
updated/repainted. If you then search your QApplication::allWidgets()'s 
list of rectangles; then I think (guessing) that only the 
topmost/foremost windows will match QPaintEvent's rectangles. I.e. 
windows that are partially or fully obscured by another window should 
receive a smaller (or none) rectangle in those QPaintEvents. That could 
be one way to establish a z-order on the fly...


Rgrds Henry

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Find frontmost widget of specific type?

2018-10-22 Thread John Weeks
We faced pretty much exactly this issue when we ported our very large 
application to Qt, starting with Qt 4.8. We have many places where we expect to 
be able to walk a window list in Z order. I wound up using Activate/Deactivate 
events to keep the list myself. I can't really recommend it- it has been pretty 
much of a nightmare to make it robust and bug-free, especially as Qt has a 
couple of bugs in their own notion of window activation. You can't really use 
the debugger to debug these issues, as the activation of the debugger changes 
the activation of the application's windows.

I have made it work pretty well, but I quake in my boots whenever I get a bug 
report about window order.

We are now using Qt 5.9 and don't have any sort of replacement for my delicate 
and difficult code.

-John Weeks
WaveMetrics, Inc.

> On Oct 22, 2018, at 11:37 AM, Israel Brewster  wrote:
> 
> 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
> ---
> 
> 
> 
>   
> 
> 
> 
> 
> 
> 
>   
> 
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Find frontmost widget of specific type?

2018-10-22 Thread Israel Brewster
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@flyravn.com]



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







BEGIN:VCARD
VERSION:3.0
N:Brewster;Israel;;;
FN:Israel Brewster
ORG:Frontier Flying Service;MIS
TITLE:PC Support Tech II
EMAIL;type=INTERNET;type=WORK;type=pref:isr...@frontierflying.com
TEL;type=WORK;type=pref:907-450-7293
item1.ADR;type=WORK;type=pref:;;5245 Airport Industrial Wy;Fairbanks;AK;99701;
item1.X-ABADR:us
CATEGORIES:General
X-ABUID:36305438-95EA-4410-91AB-45D16CABCDDC\:ABPerson
END:VCARD
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest