How to Add Context Help Button to Qt Windows

You can use the following code to add Context Sensitive Help button (“?” button in the Window title bar) to your Qt Windows, that is QWindow or QMainWindow, not QDialog which has “?” button by default.

One thing to note about this code is that you won’t have Minimize and Maximize button in the title bar, just “?” and “X” buttons will exist.

You should write this in you Window’s constructor.

setWindowFlags(Qt::Window
	| Qt::WindowContextHelpButtonHint
	| Qt::WindowCloseButtonHint);

Note: This button is used to display contents of whatsThis property for Qt widgets.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.