The .exe file has stopped working error
-
Hi all,
As the book would say, I designed a form like this:

A
.hfile like this:#ifndef SORTDIALOG_H #define SORTDIALOG_H #include <QDialog> #include "ui_sortdialog.h" class SortDialog : public QDialog, public Ui::SortDialog { Q_OBJECT public: SortDialog(QWidget* parent = 0); void setColumnRange(QChar first, QChar last); }; #endif // SORTDIALOG_Ha
.cppfile like this:#include <QtWidgets> #include "sortdialog.h" SortDialog::SortDialog(QWidget *parent) :QDialog(parent) { setupUi(this); secondaryGroupBox -> hide(); tertiaryGroupBox -> hide(); layout() -> setSizeConstraint(QLayout::SetFixedSize); setColumnRange('A', 'Z'); } void SortDialog::setColumnRange(QChar first, QChar last) { primaryColumnCombo -> clear(); secondaryColumnCombo -> clear(); tertiaryColumnCombo -> clear(); secondaryColumnCombo -> addItem(tr("None")); tertiaryColumnCombo -> addItem(tr("None")); primaryColumnCombo -> setMinimumSize( secondaryColumnCombo -> sizeHint()); QChar ch = first; while(ch <= last) { primaryColumnCombo -> addItem(QString(ch)); secondaryColumnCombo -> addItem(QString(ch)); tertiaryColumnCombo -> addItem(QString(ch)); ch = ch.unicode() + 1; } }and the
main.cppthis way:#include <QApplication> #include "sortdialog.h" int main(int argc, char* argv[]) { QApplication app(argc, argv); SortDialog* dialog = new SortDialog; dialog -> setColumnRange('C', 'F'); dialog -> show(); return app.exec(); }After running
qmakeand addingQT += widgetsto the.profile, I ran the program, but, I got this error! :(
What is the problem please?
I did these steps: From Build:
Clean all
Run qmake
Build allBut no success!
-
Add a spacer under the more button then right click on the background and select layout->lay out horizontaly
The sign that shows the problem is the red sign on the sortdialog windows in the top right of your first screenshot. that means that
layout()is null
