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.
Dialogs can be modal, in which case the user is required to provide necessary information before work in the main window can continue, or modeless. Modeless dialogs do not prevent the user from interacting with any of the other windows in the application.
// remove question mark from the title bar setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With