@tbscope: It's not that I started Qt right away, I did read a C++ tutorial (http://cplusplus.com/doc/tutorial/) at first. And when I read sample code now, I feel like I understand all of it (at least the c++ syntax).
I agree with you that my initial question was very beginnerish and that I maybe should have known it after reading the tutorial. On the other hand I believe that practicing to code is more helpful to me at the moment than to read another tutorial / book.
I stumbled upon one more question, on which I couldn't find help on the web. In the following program the button with the text "doesn't work" is not being shown. The other two buttons (in comments) work though. Why is that so?
// main.cpp
int main(int argc, char *argv[])
{
Mywidget w;
//QPushButton mybutton("works",&w);
w.resize(200,200);
w.show();
return a.exec();
}
// main.cpp
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Mywidget w;
//QPushButton mybutton("works",&w);
w.resize(200,200);
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
// mywidget.cpp
#include "mywidget.h"
#include <QWidget>
#include <QDebug>
#include <QPushButton>
{
//QPushButton *dynamic = new QPushButton("works, too", this);
}
// mywidget.cpp
#include "mywidget.h"
#include <QWidget>
#include <QDebug>
#include <QPushButton>
Mywidget::Mywidget(QWidget *parent) : QWidget(parent)
{
QPushButton mybutton("doesn't work",this);
//QPushButton *dynamic = new QPushButton("works, too", this);
}
To copy to clipboard, switch view to plain text mode
Bookmarks