我试图在我的应用程序中添加一个最小化按钮。
现在我在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.Minimized
与Windows.Windowed
具有相同的效果
我遵循这个Doc:https://doc.qt.io/qt-5/qml-qtquick-window-window.html
尝试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。