examples/macextras question



  • Inside macextras there is an example how to customise the macOS toolbar, using embeddedqwindow.

    The code looks really nice, but for some reason when closing an "embeddedqwindow" the app remains in the dock. It is usually supposed to close completely. Is this bad coding?

    Secondly, are there any other mac specific classes apart from QMacToolBar().
    QMacToolBar(), closes correctly btw in the example provided!


  • Lifetime Qt Champion

    Hi,

    Not on macOS. macOS has always been an application centric OS so closing a window doesn't mean ending the app. Just use CMD+Q and you'll quit the application properly.

    As for your other question: QMacNativeWidget and QMacCocoaViewContainer.



  • Thank you! I have tested some other apps on the mac and you are absolutely right, they all remain in the dock.

    Looks like "that is just how macs work" https://www.howtogeek.com/279086/why-do-mac-apps-stay-open-when-i-hit-the-red-x-button/

    Thank you for the c++ classes! I will take a look.



  • You can change this behavior by calling:

    setQuitOnLastWindowClosed(bool quit)
    

    macOS has always been an application centric OS so closing a window doesn't mean ending the app

    With the exception of apps called Utlity apps, usely with a single window that quit when this window is closed. (ex: Preference dialog, Disc utilty)

    I see versions of Qt reporting as inactive an mac app with no window open, that's wrong of course.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.