Hi there.
I'm folloiwng the Qt Tutorials from the Qt website (if anyone knows of better tutorials, please tell me the link).
I wrote this code on QtCreator and it gave me an error
{
Q_OBJECT
public:
explicit MyWidget
(QWidget *parent
= 0);
~MyWidget();
private:
Ui::MyWidget *ui;
};
MyWidget
::MyWidget(QWidget *parent
){
quit->setGeometry(150,150,100,100);
connect(quit,SIGNAL(clicked()),qApp,SLOT(quit()));
}
class MyWidget : public QMainWindow
{
Q_OBJECT
public:
explicit MyWidget(QWidget *parent = 0);
~MyWidget();
private:
Ui::MyWidget *ui;
};
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)//ERROR
{
QPushButton *quit = new QPushButton("Close Application", this);
quit->setGeometry(150,150,100,100);
quit->setFont(QFont("Times",12,QFont::Bold));
connect(quit,SIGNAL(clicked()),qApp,SLOT(quit()));
}
To copy to clipboard, switch view to plain text mode
Error: Type "QWidget" is not direct base of 'MyWidget'.
Could someone tell me where I've gone wrong - thanks!
Bookmarks