packtpublishing / getting-started-with-qt-5 Goto Github PK
View Code? Open in Web Editor NEWGetting Started with Qt 5, published by Packt
License: MIT License
Getting Started with Qt 5, published by Packt
License: MIT License
#include <QDateTime>
#include <QMimeDatabase>
#include <QMimeType>
are not required, please remove them , it is not good to clutter the file with not needed includes.
https://github.com/PacktPublishing/Getting-Started-with-Qt-5/blob/master/Chapter05/dragAndDrop/mainwindow.h
#include <QMainWindow>
is repeated 2 times in the #include
and the next
#include <QLabel>
#include <QDateTime>
#include <QStatusBar>
are not used and not required. Please do not confuse the reader/learner of the book, and remove them.
https://github.com/PacktPublishing/Getting-Started-with-Qt-5/blob/master/Chapter05/dragAndDrop/main.cpp
#include <Qt>
not used, not required, and you have typed the same include many times in chapter 5 and chapter 4, without explaining what it is and why it is needed (because it is NOT needed until now!). So better remove this include.
NOTE: I use Qt 5.13
https://github.com/PacktPublishing/Getting-Started-with-Qt-5/blob/master/Chapter04/centralWidget/mainwindow.cpp
The line 118 now is :
openAction = new QAction(openIcon, "&New", this);
but it should be
openAction = new QAction(openIcon, "&Open", this);
The same error appears in the code of the book text, but I know you cannot correct it in the book, so at least fix it here in github.
Also the same error is on line 99 of file
https://github.com/PacktPublishing/Getting-Started-with-Qt-5/blob/master/Chapter04/dialogs/mainwindow.cpp
In the .h files I notice the
#include <QtGui>
#include <Qt>
but I can build the project without them. Why are they typed? It is not good to have things that are not required.
Also many times the
#include <QAction>
is typed 2 times. This looks so unprofessional, it makes the book suspicious. It appears in the text of the book, but at least eliminate those redundant lines from the code here in github!
NOTE: I use Qt 5.13
#include <QMoveEvent>
#include <QMouseEvent>
but only one of them is required, I suggest to leave only the QMouseEvent
#include <QDebug>
#include <QDateTime>
not required, not used anywhere, please remove both of them.
https://github.com/PacktPublishing/Getting-Started-with-Qt-5/blob/master/Chapter05/customSignalsAndSlots/main.cpp
#include <Qt>
not required, not used.
And as usual , may empty lines, that is annoying to read.
NOTE: I use Qt 5.13
https://github.com/PacktPublishing/Getting-Started-with-Qt-5/blob/master/Chapter05/dragAndDrop/dragTextEdit.cpp
line 18 : QTextStream out(stdout);
is never used for anything. I commented it out in my branch, and I can still compile, and run.
As a consequence of deleting the above line, you can delete the
https://github.com/PacktPublishing/Getting-Started-with-Qt-5/blob/master/Chapter05/dragAndDrop/dragTextEdit.h
#include <QDebug>
NOTE: I use Qt 5.13
https://github.com/PacktPublishing/Getting-Started-with-Qt-5/blob/master/Chapter04/menuBars/mainwindow.h
There are the following private members (lines 33,34):
QAction *saveAction;
QAction *cancelAction;
but they are never used in the .cpp file. Either eliminate them from the .h file, or implement them in the .cpp file to produce a richer result in the GUI. I suggest to remove them from the menuBars project, because it is the first to appear in the book, but keep them (and implement them in the .cpp ) for the toolBars project which appears 2nd in the book, so it is logical to make the 2nd project a little longer/harder.
NOTE: I use Qt 5.13
Almost all of the .cpp files have many empty lines at the end of the functions, just before the closing brace }
This is annoying, a waste of space, and requires more scrolling.
And inside the functions body, oftentimes there are 2 empty lines to separate different logical chunks of code, but it is better to have only 1 empty line.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.