我正在尝试添加一个最小化的按钮在我的应用程序中。
现在,我只在Mac Os中遇到了一些问题。我在Linux上测试并赢得了测试,我没有问题。
有什么想法吗?
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,这里有do see the ApplicationWindow的链接:https://github.com/LetheanMovement/lethean-gui/blob/master/main.qml
我尝试在FullScreen中使用相同的代码,并且运行良好!
appWindow.visibility = Window.FullScreen有趣的是:如果我在FullScreen模式下,我的Windows.Minimized具有与Windows.Windowed相同的效果
我正在关注这个文档:https://doc.qt.io/qt-5/qml-qtquick-window-window.html
发布于 2019-02-12 17:47:50
在此之前尝试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。
https://stackoverflow.com/questions/54636336
复制相似问题