Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-103085

QVersionNumber doesn't indicate its type in QDebug output

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 6.3.1, 6.4.0 Beta1
    • 6.3
    • Core: Other
    • None
    • 9bd4e0fe13 (qt/qtbase/dev) 9bd4e0fe13 (qt/tqtc-qtbase/dev) 52673e389b (qt/qtbase/6.3) 52673e389b (qt/tqtc-qtbase/6.3)

    Description

      Contrary to most (all?) other classes, the output of qDebug() << QVersionNumber(1, 2, 3) is just 1.2.3 rather than something more descriptive (when outputting other objects), such as QVersionNumber(1.2.3) or so.

      I'd propose something like the following patch:

      diff --git i/src/corelib/tools/qversionnumber.cpp w/src/corelib/tools/qversionnumber.cpp
      index 7ec0e45dd1..6494603a11 100644
      --- i/src/corelib/tools/qversionnumber.cpp
      +++ w/src/corelib/tools/qversionnumber.cpp
      @@ -531,7 +531,8 @@ QDataStream& operator>>(QDataStream &in, QVersionNumber &version)
       QDebug operator<<(QDebug debug, const QVersionNumber &version)
       {
           QDebugStateSaver saver(debug);
      -    debug.noquote() << version.toString();
      +    debug.nospace().noquote();
      +    debug << "QVersionNumber(" << version.toString() << ")";
           return debug;
       }
       #endif
      

      Unfortunately, I can't seem to get Qt to build right now (missing /usr/lib/librt.so, only librt.so.1 seems to exist), thus I can't even try if this builds, so I didn't submit it to gerrit.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            the compiler Florian Bruhin
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes