QWindow :: Minimized在Mac Os上无法正常工作

问题描述 投票:0回答:1

我试图在我的应用程序中添加一个最小化按钮。

现在我在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具有相同的效果

我遵循这个Doc:https://doc.qt.io/qt-5/qml-qtquick-window-window.html

qt qml
1个回答
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。

© www.soinside.com 2019 - 2024. All rights reserved.