I want to remove the “?”-button from a Qt dialog like explained here, but somehow it doesn’t work.
This is my code:
Qt::WindowFlags flags;
flags = (Qt::Dialog | Qt::WindowStaysOnTopHint) &
~Qt::WindowContextHelpButtonHint;
setWindowFlags( flags );
I think that there is something wrong with the bitwise operators, but I don’t know what..
This works fine for me:
The most common way, however, is to pass the flags in the constructor:
EDIT: I think there is a misunderstanding about the QFlags operators (see comments below). This example might clear it up:
The penultimate line of code removes
Qt::WindowContextHelpButtonHintfromflags. It does not add a “negative” flag.At least that is my understanding.