[Interest] Modeless dialog issue on Mac

Tor Arne Vestbø Tor.arne.Vestbo at qt.io
Wed Nov 15 14:04:41 CET 2023


As a workaround you can try static_cast<NSView*>(window.winId()).window.windowLevel = NSNormalWindowLevel + 1

In a .mm file or build your cpp file with -x objective-c++

On 15 Nov 2023, at 14:02, Calogero Mauceri <mauceri at actgate.com> wrote:

You don't often get email from mauceri at actgate.com. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
Thanks Oliver for you hint,

I tried the example application you suggested, it seems none of the flags combination results in the wanted result: either the window is behind the main application or it is on top of all desktop applications

On Wed, Nov 15, 2023 at 1:25 PM Oliver Knoll <till.oliver.knoll at gmail.com<mailto:till.oliver.knoll at gmail.com>> wrote:


Am 15.11.2023 um 13:14 schrieb Oliver Knoll <till.oliver.knoll at gmail.com<mailto:till.oliver.knoll at gmail.com>>:

But I understand your use case better now, and yes, it is different from mine. However I don‘t know any „top of application (only)“ flag myself (not saying that Qt doesn’t provide such a flag - I just don’t know).

And what do we do if we developers are too lazy to read the fine manual? Exactly! We have someone else read it for us - like your favourite LLM! ;)

Here is what ChatGPT has to say about it:

https://zzzcode.ai/answer-question?id=d21e6762-84c8-406c-823c-f379471ce766

Quote: „ Yes, in Qt, there is a flag that can be used to make a modeless dialog stay on top of the application. This flag is called Qt::WindowStaysOnTopHint. By setting this flag on a modeless dialog, you can ensure that the dialog remains on top of all other windows in the application.“

And even better: a quick research reveals that this flag („hint“) actually seems to exist ;)

In fact, you can try it out right away and tell us how it went:

https://doc.qt.io/qt-6/qtwidgets-widgets-windowflags-example.html

;)

Hope that helps!
  Oliver



--
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com<http://www.actgate.com/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231115/093503d6/attachment.htm>


More information about the Interest mailing list