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

QVariant::toString description potentially incorrect.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P4: Low P4: Low
    • 5.11.0
    • 5.10.1
    • Documentation
    • None

      The description of the QVariant::toString function reads:

      Returns the variant as a QString if the variant has userType() QMetaType::QStringQMetaType::BoolQMetaType::QByteArrayQMetaType::QCharQMetaType::QDateQMetaType::QDateTimeQMetaType::DoubleQMetaType::IntQMetaType::LongLongQMetaType::QStringListQMetaType::QTimeQMetaType::UInt, or QMetaType::ULongLong; otherwise returns an empty string.

      However, there are several other values of QMetaType that will generate a non-empty string, namely: QMetaType::Float, QMetaType::Short, QMetaType::UShort, QMetaType::Long, QMetaType::ULong, QMetaType::SChar, QMetaType::UChar, etc...

      I can only assume that this intended behaviour (why would Double be printed and not Float??), so I believe that the documentation is incorrect.

       

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

            paulwicking Paul Wicking
            lscott Lewis Scott
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 30 minutes
                30m
                Remaining:
                Remaining Estimate - 30 minutes
                30m
                Logged:
                Time Spent - Not Specified
                Not Specified

                  There are no open Gerrit changes