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

QJsonValue::fromVariant missing case for QMetaType::(U)Short

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.4, 5.13.0
    • None
    • All

    Description

      QJsonValue::fromVariant is missing switch case for QMetaType::Short and QMetaType::UShort and forces those to string rather than expected number (QJsonValue::Double).

      // works as expected
      Q_ASSERT(QJsonValue::fromVariant(QVariant::fromValue<int>(-123)).type() == QJsonValue::Double);
      Q_ASSERT(QJsonValue::fromVariant(QVariant::fromValue<uint>(123)).type() == QJsonValue::Double);
      
      // fails
      Q_ASSERT(QJsonValue::fromVariant(QVariant::fromValue<short>(-123)).type() == QJsonValue::Double);
      Q_ASSERT(QJsonValue::fromVariant(QVariant::fromValue<ushort>(123)).type() == QJsonValue::Double);
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            kristjanbb Kristján Birgisson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes