[Interest] Modeless dialog issue on Mac

Calogero Mauceri mauceri at actgate.com
Wed Nov 15 11:01:36 CET 2023


The problem of using Qt::WindowStaysOnTopHint is that the dialog stays on
top of any desktop application while it has to be on top of the application
level only. Here is what I mean

[image: unnamed.png]



On Tue, Nov 14, 2023 at 7:12 PM Tor Arne Vestbø via Interest <
interest at qt-project.org> wrote:

> A non-modal Dialog (NSPanel) isn’t inherently at a higher window level
> than a normal window on macOS:
>
> [image: developer-og.jpg]
>
> NSWindowLevel | Apple Developer Documentation
> <https://developer.apple.com/documentation/appkit/nswindowlevel?language=objc>
> developer.apple.com
> <https://developer.apple.com/documentation/appkit/nswindowlevel?language=objc>
>
> <https://developer.apple.com/documentation/appkit/nswindowlevel?language=objc>
>
> We could potentially work around it by using a non-standard window level,
> but it might have unforeseen consequences.
>
> I recommend using the Qt::WindowStaysOnTopHint as a workaround.
>
> Tor Arne
>
>
> On 14 Nov 2023, at 18:55, Oliver Knoll <till.oliver.knoll at gmail.com>
> wrote:
>
>
>
> Am 14.11.2023 um 16:29 schrieb Calogero Mauceri <mauceri at actgate.com>:
>
> 
> Here "this" is a pointer to the parent dialog. I've tried with QMainWindow
> too as a parent, but unfortunately the problem is still there, not sure if
> that's another bug.
> The only way I found for having the modeless dialog on top of its parent
> is to create it with Qt::Tool flag.
>
>
> You don‘t need to create a „tool window“: any QWidget (QWindow?) based
> window should do.
>
> From the top of my head there should exist an „always on top“ window flag.
> Pass this to the constructor of your QDialog, refer to the Qt docs wrt
> „window flags“ (or similar).
>
> I definitively managed to keep a QMainWindow „always on top“ with this
> approach (Win/Mac/Linux), but I expect this to work with QDialogs, too.
>
> Best,
>  Oliver
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>


-- 
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231115/49ae22d4/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: developer-og.jpg
Type: image/jpeg
Size: 39580 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231115/49ae22d4/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unnamed.png
Type: image/png
Size: 191654 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231115/49ae22d4/attachment-0001.png>


More information about the Interest mailing list