[Qt-interest] Menu bar on QtCreator created GUI

OS Prog osprog at gmail.com
Thu Jul 15 09:47:10 CEST 2010


> What is the purpose of this widget you created after initializing ui?
>
I have several classes derived from QWidget and I give them a parent
QMainWindow. Some of them are graphics, others are plots, I have
nonGUI classes as well.
> If it is going to be a window, you may add  Qt::Window flag which should fix the problem.
> QWidget* p = new QWidget(this, Qt::Window);
>
> If it is going to be a dialog just it from the QDialog.
> If you want to display this widget somewhere at the Central Widget area use centralWidget as a parent.
>
> As is, I guess QMainWindow is not expecting to have children which are not created with Qt::Window flag.
>
Well, it doesn't block all iteractions, but only the QMenuBar. The
rest of the QMainWindow seems to behave well.

> I am still surprised that just creating QWidget child leads to blocking all interaction, and
> I would assume this is a bug, cause it might affect ability to add graphical elements beside existing to QMainWindow,
>
> But this might be not your case.
> So either find proper parent or make sure that isWindow returns true ( derive from the different class , put flag, etc).
>
> Hope this helps,
>   Alex




More information about the Qt-interest-old mailing list