How to create an clean an simple window for macosx without dock entry and any menubar?



  • Hi

    I'm new to QtQuick and like to way to desing an application. But unfortunately I don't know how to configure my application as I want.

    Currently I am at a mac and I want my application to look and feel like the macosx spotlight window.
    !https://9to5mac.files.wordpress.com/2014/06/screenshot-2014-06-02-13-22-08.jpg?w=704&h=398(picture of spotlight)!

    It is an window without decoration, without an menu bar and without an application entry at the task bar called "dock" macosx as show at the image. If you click outside of the window it will simply disapear.

    How do I have to modify my qml application window?

    @
    ApplicationWindow {
    width: 640
    height: 40
    opacity: 0.9
    visible: true
    flags: Qt.Window

    TaskBarForm {
        id: taskBarForm1
        anchors.fill: parent
    
        Keys.onEscapePressed: {
            Qt.quit()
        }
    
        onActiveFocusChanged: {
            if (Window.activeFocusItem == null)
                Qt.quit()
        }
    
    
    }
    

    }
    @


  • Moderators

    Hi robert23,

    the basic idea is to create a Window with 'Qt.Popup' flag set. Unfortunately this feature is broken in Qt 5.4.0, at least on Windows and Linux. But I have found a workaround for this:

    @
    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtQuick.Window 2.2

    ApplicationWindow {
    id: window
    width: 100
    height: 100
    visible: false

    property var popup: null
    
    property string comp: "import QtQuick 2.4
        import QtQuick.Controls 1.3
        import QtQuick.Controls.Private 1.0
        PopupWindow {
        id: window
    
        Rectangle {
            id: rect
            width: 400
            height: 300
    
            Button {
                text: 'Close'
                anchors.centerIn: parent
                onClicked: dismissPopup()
            }
        }
    }"
    
    function afterPopupClosed() {
        popup.destroy()
        window.close()
    }
    
    Component.onCompleted: {
        popup = Qt.createQmlObject( comp, window )
        popup.popupDismissed.connect( afterPopupClosed )
        popup.x = 200
        popup.y = 300
        popup.show()
    }
    

    }
    @

    I don't have a Mac, so I only tested it on Windows and Linux. But would be nice to hear from you if it works on Mac OS, too.



  • [quote author="Wieland" date="1424567026"]Hi robert23,
    I don't have a Mac, so I only tested it on Windows and Linux. But would be nice to hear from you if it works on Mac OS, too.
    [/quote]

    Hey Wieland

    First of all, thanks for your reply.

    Unfortunately it doesn't work at macosx. The window has no decoration and disappears after loosing the focus but it still has an dock entry and has a menu.

    I've seen that, this kind of mac windows also has an special type of form with round corners.

    I've made an video to see this.
    http://youtu.be/IQtC66YpQko

    Robert


  • Moderators

    Sorry, no idea :-/


Log in to reply
 

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