PDA

View Full Version : QDialog::setWindowFlags() problem



Lemming
28th July 2006, 20:42
Hi all!

There is some modal dialogs in my app, and I want those dialogs to be shown centered relatively to the main window of the app. Every dialog is subclassed form QDialog, has its own constructor and is invoked by QDialog::exec() method. Correct parent is passed to every dialog upon initialization.

Everything works fine and the dialogs are shown centered in relation to their parent window unless I add the following line to the constructor of any dialog:


setWindowFlags( windowFlags() & ~Qt::WindowContextHelpButtonHint );

Whenever this line is added, the dialog is always shown at the arbitrary lacation close to the top-left corner of the main window.

Can someone explain what's happening here? And what's the best solution for this case (I have to remove that question mark from the dialogs anyway).

Thanks in advance.

gfunk
29th July 2006, 00:06
It's probably related to http://doc.trolltech.com/qtjambi-1.0/qwidget.html#windowFlags-prop
but I couldn't tell you what you should be doing to avoid this problem.

Lemming
8th August 2006, 16:26
Just in case somebody else encounters the same problem: I have contacted Trolltech support over this problem and they've accepted it as their bug. Probably should be fixed in one of the upcoming QT releases.