QWindow :: Minimized在Mac Os上无法按预期工作

时间:2019-02-11 17:50:45

标签: qt qml

我正在尝试在我的应用中添加一个最小化按钮。

目前,我在Mac OS上遇到了一些问题。 我在Linux和Win上进行了测试,但没有问题。

有什么想法吗?

Rectangle {
    property bool containsMouse: titleBar.mouseX >= x + row.x && titleBar.mouseX <= x + row.x + width && titleBar.containsMouse
    anchors.top: parent.top
    anchors.bottom: parent.bottom
    width: height
    color: containsMouse ? "#3665B3" : "#000000"

    Image {
        anchors.centerIn: parent
        source: "../images/minimizeIcon.png"
    }

    MouseArea {
        id: minimizeArea
        anchors.fill: parent
        onClicked: {
            // I can see this in Mac Os but don't work
            console.log("its work")
            appWindow.visibility = Window.Minimized
        }
   }
}

appWindow是我的ApplicationWindow {} // has all my content 有链接请参阅ApplicationWindow:https://github.com/LetheanMovement/lethean-gui/blob/master/main.qml

我试图对FullScreen使用相同的代码,并且效果很好!

appWindow.visibility = Window.FullScreen

有趣的是:如果我处于全屏模式,我的Windows.MinimizedWindows.Windowed的效果相同

我关注此文档:https://doc.qt.io/qt-5/qml-qtquick-window-window.html

1 个答案:

答案 0 :(得分:0)

尝试appWindow.visibility = Window.Windowed之前:

    onClicked: {
        // I can see this in Mac Os but don't work
        console.log("its work")
        appWindow.visibility = Window.Windowed
        appWindow.visibility = Window.Minimized
    }

在ArchLinux上工作。