[Qt-interest] QDialog is blank

David Doria daviddoria at gmail.com
Tue Jun 7 13:27:03 CEST 2011


On Mon, Jun 6, 2011 at 10:22 PM, Malyushytsky, Alex <alex at wai.com> wrote:
> Mostly likely you don't have form.ui preprocessed by uic.exe
>
> It looks like that you don't use qmake, which would invoke uic.exe on ui files automatically.
> So check your "ui_form.h" - it should contain a valid c++ code.
> If it does not - check how people invoke it with building tool you are using.
>
>>>Also, I've seen examples that use ->exec() instead of ->show(), but
> when I try that it says there is no such function.
>
> exec() is a slot (function) available at QDialog which will open dialog in the modal mode.
> Your Form is QWidget subclass, so you can't call exec for it.
>
> Alex

Thanks for the replies. I made the two suggested changes:

class Dialog : public QWidget, private Ui::Dialog
to
class Dialog : public QDialog, private Ui::Dialog

and then that allowed

myDialog->show();
to
myDialog->exec();

However, the behavior did not change. The dialog that appears is still blank.

The ui_form.h and ui_dialog.h look correct - they are generated from
CMakeLists.txt by the line QT4_WRAP_CPP(MOCSrcs dialog.h form.h)

Any other thoughts?

Thanks,

David



More information about the Qt-interest-old mailing list