QDbus chat example viz qdbusxml2cpp
-
The Qt Dbus chat example, modified from Troltech 4.8, no longer contains the include and source files for the d-bus adapter and interface, rather those include files are built each time the project is compiled. The documentation on
https://doc.qt.io/qt-5/qdbusxml2cpp.html proclaims:The qdbusxml2cpp tool is not meant to be run every time you compile your application.
Could not the example include the source and include files with an explanation of how qdbusxml2cpp created them from the xml file? Upon first glance, the casual reader may be astonished that build/run just works. There should be an instruction to run more than one instance of the chat window, otherwise the user experience does not match the image with two instances chatting among themselves. Perhaps there could be a tutorial with full documentation of each function? Is it not considered bad form to include main(), mainwindow(), and all in one c++ file?
-
The qdbusxml2cpp tool could be modified to change the pointer to QObject from zero to nullptr.
QObject *parent = nullptr
A pass through all of the examples hunting for *parent=0 would help bring things up to C++11? If I can be of assistance in this matter, do not hesitate to contact me.
-
Hi,
Nice catch !
Would you consider submitting a patch to fix that ? :-)
-
@sgaist said in QDbus chat example viz qdbusxml2cpp:
Would you consider submitting a patch to fix that ? :-)
No need for it anymore since at least https://codereview.qt-project.org/c/qt/qtbase/+/267839 I would guess :)
/edit: there are still a lot left, will let clang-tidy to the rest :)
/edit2: https://codereview.qt-project.org/c/qt/qtbase/+/272360 -
@SGaist There are inconsistent styles, making things a bit more difficult.
*parent = 0
*parent=0
* parent = 0
QObject * parent = 0
Invoking the style police is a matter for another topic. (K&R vs Stroustrup?)
Only two headers use the spaceless assignment:find Qt/Examples/Qt-5.13.0 -type f -name "*.h" \ -exec grep --with-filename "parent=0" {} \;
Qt/Examples/Qt-5.13.0/quick/models/objectlistmodel/dataobject.h
2x QObject parent=0
Qt/Examples/Qt-5.13.0/sensors/sensor_explorer/import/propertyinfo.h
1x QObject parent=0
Easy manual edit, or-exec sed 's,parent=0,parent=nullptr,g' -i {} \;
As for the rest:
find Qt/Examples/Qt-5.13.0 -type f -name "*.h" \ -exec sed 's,parent = 0,parent = nullptr,g' -i {} \;
-
Looks like @Christian-Ehrlicher is already working on it so it should be good in a near future release.
-
At least in QtBase, not the rest. So patches for all other modules are welcome.