qt - QWindow::Minimized 在 Mac Os 上无法按预期工作
问题描述
我试图在我的应用程序中添加一个最小化按钮。
现在我在 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
我关注这个文档: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 上工作。
推荐阅读
- python - 我将如何循环遍历元素 Python Selenium
- r - 如何在 ggplot 条形图中绘制标准误差条?
- python - 逐位读取保持寄存器 Siemens
- vb.net - 从 pdf 中获取注释以添加到另一个文档
- python-2.7 - Python cron 作业返回与手动执行不同的输出
- powershell - 无法访问 Powershell 上的 API
- ffmpeg - Windows 10 EV 代码签名不再适用于电子应用程序
- azure - 在 Azure DevOps(本地)上支持小型/个人项目/存储库的最佳实践
- python - python在运行代码时生成netaddr错误
- swift - 表视图数据加载后如何停止活动视图指示器