Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QDbus chat example viz qdbusxml2cpp

    General and Desktop
    3
    8
    242
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Psnarf
      Psnarf last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • Psnarf
        Psnarf last edited by

        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.

        Psnarf 1 Reply Last reply Reply Quote 1
        • Psnarf
          Psnarf @Psnarf last edited by

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

          1 Reply Last reply Reply Quote 1
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Hi,

            Nice catch !

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

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 1
            • Christian Ehrlicher
              Christian Ehrlicher Lifetime Qt Champion last edited by Christian Ehrlicher

              @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

              Qt has to stay free or it will die.

              1 Reply Last reply Reply Quote 1
              • Psnarf
                Psnarf last edited by

                @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 {} \;
                
                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

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

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply Reply Quote 0
                  • Christian Ehrlicher
                    Christian Ehrlicher Lifetime Qt Champion last edited by

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

                    Qt has to stay free or it will die.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post