I don't quite follow your code.
Basically, the idea is as follows:
Your widgets sets up itself, i.e.
// der
class YourWidget
: public QWidget,
private Ui_YourWidget
{
{
setupUi(this);
}
}
// der
class YourWidget : public QWidget, private Ui_YourWidget
{
YourWidget(QWidget *parent=0) : QWidget(parent)
{
setupUi(this);
}
}
To copy to clipboard, switch view to plain text mode
or
// variant 2: do not derive, place ui as a member variable
class YourWidget :
{
Ui_YourWidget ui;
{
ui.setupUi(this);
}
}
// variant 2: do not derive, place ui as a member variable
class YourWidget :
{
Ui_YourWidget ui;
YourWidget(QWidget *parent=0) : QWidget(parent) {}
{
ui.setupUi(this);
}
}
To copy to clipboard, switch view to plain text mode
You do not call setupUi from a QApplication(-subclass). Which it looks like you are trying to.
Your main is then something like:
int main(int argc, char **argv)
{
QApplication app
(argc,argv
);
// use your subclass here, if you have one YourWidget yw;
yw.show();
return app.exec();
}
int main(int argc, char **argv)
{
QApplication app(argc,argv); // use your subclass here, if you have one
YourWidget yw;
yw.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Of course, more advanced programs will do more. This are but the basic building blocks.
HTH
Bookmarks