By default the Qt::WindowContextHelpButtonHint flag is added to dialogs.
You can control this with the WindowFlags parameter to the dialog constructor.
For instance you can specify only the TitleHint and SystemMenu flags by doing:
QDialog *d = new QDialog(0, Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
d->exec();
If you add the Qt::WindowContextHelpButtonHint flag you will get the help button back.
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_()
More details on window flags can be found on the WindowType enum in the Qt documentation.
The answers listed here will work, but to answer it yourself, I'd recommend you run the example program $QTDIR/examples/widgets/windowflags. That will allow you to test all the configurations of window flags and their effects. Very useful for figuring out squirrelly windowflags problems.
I ran into this issue in Windows 7, Qt 5.2, and the flags combination that worked best for me was this:
Qt::WindowTitleHint | Qt::WindowCloseButtonHint
This gives me a working close button but no question mark help button. Using just Qt::WindowTitleHint or Qt::WindowSystemMenuHint got rid of the help button, but it also disabled the close button.
As Michael Bishop suggested, it was playing with the windowflags example that led me to this combination. Thanks!
As the solution for PyQt4 from @amos didn't work for me and the version of PyQt4 is deprecated, here is my solution on how to remove the "?" in the dialog-box in PyQt5:
class window(QDialog):
def __init__(self):
super(window, self).__init__()
loadUi("window.ui", self)
self.setWindowFlag(QtCore.Qt.WindowContextHelpButtonHint,False) # This removes it