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

Don't try to convert transfered QVariants using variant.canConvert<QVariant>()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.12.2
    • Remote Objects
    • None

    Description

      When using QVariant as a type for a property. The generated code looks like this:

          QVariant varValue() const
          {
              const QVariant variant = propAsVariant(2);
              if (!variant.canConvert<QVariant>()) {
                  qWarning() << "QtRO cannot convert the property varValue to type QVariant";
              }
              return variant.value<QVariant >();
          }
      

      As the property is already available as a QVariant internally, there is no need to convert this again.

      Trying to convert it is also a problem as a default constructed QVariant() results in a invalid QVariant and cannot be converted, which means the following error message is shown when no "valid" QVariant is send:

      QtRO cannot convert the property varValue to type QVariant

      Attachments

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

        Activity

          People

            bstottle Brett Stottlemyer
            gagi Dominik Holland
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes