如何隐藏/删除“?"“标题栏"上的帮助按钮Qt 对话框? [英] How can I hide/delete the "?" help button on the "title bar" of a Qt Dialog?

查看:32
本文介绍了如何隐藏/删除“?"“标题栏"上的帮助按钮Qt 对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的一个应用程序中使用 Qt Dialogs.我需要隐藏/删除帮助按钮.但是我无法找到他的帮助按钮句柄的确切位置.不确定它是否是 Qt 窗口上的特定标志.

I am using Qt Dialogs in one of my application. I need to hide/delete the help button. But i am not able to locate where exactly I get the handle to his help button. Not sure if its a particular flag on the Qt window.

推荐答案

默认情况下,Qt::WindowContextHelpButtonHint 标志被添加到对话框中.您可以使用对话框构造函数的 WindowFlags 参数来控制它.

By default the Qt::WindowContextHelpButtonHint flag is added to dialogs. You can control this with the WindowFlags parameter to the dialog constructor.

例如,您可以通过执行以下操作仅指定 TitleHintSystemMenu 标志:

For instance you can specify only the TitleHint and SystemMenu flags by doing:

QDialog *d = new QDialog(0, Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
d->exec();

如果您添加 Qt::WindowContextHelpButtonHint 标志,您将重新获得帮助按钮.

If you add the Qt::WindowContextHelpButtonHint flag you will get the help button back.

在 PyQt 中你可以:

In PyQt you can do:

from PyQt4 import QtGui, QtCore
app = QtGui.QApplication([])
d = QtGui.QDialog(None, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
d.exec_()

有关窗口标志的更多详细信息可以在 WindowType enum 在 Qt 文档中.

More details on window flags can be found on the WindowType enum in the Qt documentation.

这篇关于如何隐藏/删除“?"“标题栏"上的帮助按钮Qt 对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆