简体   繁体   English

Qt C ++最小化和最大化窗口

[英]Qt C++ minimize and maximize window

I create main window by using class QWidget and setup window flag to Qt::CustomizeWindowHint (to disable title bar). 我通过使用类QWidget和设置窗口标志来创建主窗口到Qt :: CustomizeWindowHint(以禁用标题栏)。 But than I found problem - when I click on my program button on Windows taskbar - program won't minimize and maximize. 但是我发现问题 - 当我点击Windows任务栏上的程序按钮时 - 程序不会最小化和最大化。 What can I do to remove this problem? 我该怎么做才能解决这个问题? I use Windows 7. Sorry 4 my bad english. 我使用Windows 7.抱歉4我的英文不好。

这是Qt :: CustomizeWindowHint的功能。当使用这个windows标志时,你很难控制窗口。你可以尝试的是在窗口中添加两个按钮并将它们连接到showMaximized()showMinimized() 。然后你可以最大化或者单击按钮最小化窗口。

This answer is a while ago but I faced the same challenge now and could find a solution. 这个答案是不久前的,但我现在面临同样的挑战,可以找到解决方案。 Maybe its helpfull for someone else. 也许它对其他人有帮助。 As proposed before one should specify Qt::FramelessWindowHint instead of Qt::CustomizeWindowHint . 如前所述,应该指定Qt::FramelessWindowHint而不是Qt::CustomizeWindowHint This also hides the title and border of the window. 这也隐藏了窗口的标题和边框。 To still have the minimize/maximize feature I additionaly specified Qt::WindowSystemMenuHint , Qt::WindowMinimizeButtonHint and Qt::WindowMaximizeButtonHint . 为了仍然具有最小化/最大化功能,我另外指定了Qt::WindowSystemMenuHintQt::WindowMinimizeButtonHintQt::WindowMaximizeButtonHint That's it! 而已!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM