Qt:带有关闭、最小化和帮助按钮的 QMainWindow [英] Qt: QMainWindow with a close, minimize and help button
问题描述
如果我有一个继承 QMainWindow 的类,并且我希望它只有按钮;在窗口栏中关闭、最小化和帮助,我应该如何进行?
If I have a class which inherits QMainWindow, and I want it to only have the buttons; close, minimize and help in the window bar, how should I proceed?
如果我将此代码用于窗口标志:setWindowFlags(Qt::Window | Qt::WindowContextHelpButtonHint | Qt::WindowMinimizeButtonHint);
它会生成一个带有最大化、最小化和关闭按钮的窗口.
If I use this code for the window flags:
setWindowFlags(Qt::Window | Qt::WindowContextHelpButtonHint | Qt::WindowMinimizeButtonHint);
It results in a window with maximize, minimize and close button.
如果排除WindowMinimizeButtonHint",则只有帮助和关闭按钮.
If I exclude "WindowMinimizeButtonHint", there is only a help and close button.
如果可能,我怎样才能使只有关闭、帮助和最小化按钮?
How can I, if possible, make so there is a close, help AND minimize button ONLY?
推荐答案
根据微软的 文档..
WS_EX_CONTEXTHELP 不能与 WS_MAXIMIZEBOX 或WS_MINIMIZEBOX 样式.
WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.
Qt::WindowContextHelpButtonHint
、Qt::WindowMinimizeButtonHint
和 Qt::WindowMaximizeButtonHint
的底层 Windows 系统标志.
which are the underlying windows system flags for Qt::WindowContextHelpButtonHint
, Qt::WindowMinimizeButtonHint
and Qt::WindowMaximizeButtonHint
.
这篇关于Qt:带有关闭、最小化和帮助按钮的 QMainWindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!