PDA

View Full Version : Problem with "C++ GUI Programming with Qt4, 2nd Edition"



LonelyZero
19th May 2018, 07:13
Hey, folks.

So i'm trying to go over Qt with this book "C++ GUI Programming with Qt4, 2nd Edition". Two first exercises worked well with my Qt Creator 4.5.1 and mingw32 but then i got into first "big" program. Qt went apeshit with like 40 errors or something. What am i doing wrong? I guess it's version compatibility problem.

That's example from the book.

12824
12825
12826
12827

kbsk007
19th May 2018, 15:43
this book was written for with Qt4 and you use Qt5
therefore you have to add to your finddialog.cpp file
the include statements:

#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>

d_stranz
19th May 2018, 16:20
You will likely also have to edit (slightly) code that creates QMainWindow instances to use Qt::WindowFlags instead of whatever was used in Qt 4. That was so long ago I've forgotten.

Lesiok
20th May 2018, 08:48
Read this article (https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5).