setSizeConstraint and segmentation fault
I have a example source code from C++ GUI Programming with Qt 4 book. There is in main class construct:
Code:
SortDialog
::SortDialog(QWidget *parent
)
setupUi(this);
secondaryGroupBox->hide();
tertiaryGroupBox->hide();
//layout()->setSizeConstraint(QLayout::SetFixedSize);
setColumnRange('A', 'Z');
}
When I compile this in this form, everything works ok. But if I remove this comment, after compile when I want to run this app, I have segmentation fault.
There is no diffrent if I replace SetFixedSize for e.g. SetMaximumSize or someone else from enum SizeConstraint from QLayout class.
Why isn't it work?
Qt4.3.3
Re: setSizeConstraint and segmentation fault
That's because you don't have a main(top level) layout set in your dialog.
What you have to do is to open the ui file in designer, right click the form and choose a layout for it(whatever you need). Next save the ui, rebuild and it will work.
Re: setSizeConstraint and segmentation fault