Important: Please read the Qt Code of Conduct -

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 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.

  • There are only 267 files with "*pointer=0" in Qt/Examples/Qt-5.13.0. Easy to fix with find -exec sed.

  • Lifetime Qt Champion


    Nice catch !

    Would you consider submitting a patch to fix that ? :-)

  • Lifetime Qt Champion

    @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 I would guess :)

    /edit: there are still a lot left, will let clang-tidy to the rest :)

  • @SGaist There are inconsistent styles, making things a bit more difficult.
    *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" {} \; 

    2x QObject parent=0
    1x QObject
    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 {} \;

  • Lifetime Qt Champion

    Looks like @Christian-Ehrlicher is already working on it so it should be good in a near future release.

  • Lifetime Qt Champion

    At least in QtBase, not the rest. So patches for all other modules are welcome.

Log in to reply