I am trying to learn Qt with a fairly simple application:
#include <QtGui/QApplication>
#include <QPushButton>
#include <QDebug>
class BareBase {
public:
BareBase();
};
class BareBones: public QApplication {
private:
BareBase* base;
public:
BareBones(int &argc, char **argv);
~BareBones();
};
BareBase::BareBase()
{
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
}
BareBones::BareBones(int& argc, char** argv): QApplication(argc, argv)
{
qDebug() << "Creating new instance ... ";
base = new BareBase();
}
BareBones::~BareBones()
{
qDebug() << "Cleaning up ... ";
delete base;
}
int main(int argc, char **argv)
{
BareBones app(argc, argv);
return app.exec();
}
Now the problem is that the button created in BareBasenever appears, and I am puzzled why?
user350814
source
share