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

ActiveQt cannot set properties of type short

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.5.0
    • 5.4.0
    • ActiveX Support
    • None

    Description

      When using Com Objects with properties of type short cannot be set.
      I get the warning "QAxBase::setProperty: Unhandled property type int"

      The reason for this is IMHO the in the Function
      QVariantToVARIANT in the File qaxtypes.cpp.

      bool QVariantToVARIANT (..)
      {
      ...
      QVariant::Type proptype = typeName.isEmpty() ? QVariant::Invalid : QVariant::nameToType("short");
      
      delivers proptype == QMetaType::Short
      so the following if statement 
      
      if ((proptype == QVariant::UserType || proptype == int(QMetaType::QVariant)) && !typeName.isEmpty()) {
              if (typeName == "short" || typeName == "char")
                  proptype = QVariant::Int;
              else if (typeName == "float")
                  proptype = QVariant::Double;
          }
      

      will not patch the proptype to QVariant::Int and qvar.type stays on QMetaType::Short causing the property is not set at all.
      I assume the same problem will exist for char and float property types.

      Added an example and the corresponding ocx

      Attachments

        1. activeXDemo.zip
          51 kB
          Magnus Moehr
        2. qtbug45057_diag4.diff
          2 kB
          Friedemann Kleint
        3. qtbug45057.zip
          2 kB
          Friedemann Kleint
        4. qtbug45057_plugin.zip
          4 kB
          Friedemann Kleint
        5. 0001-Qt-4-Add-test-for-QVariant-VARIANT-conversion.patch
          8 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            mohrm Magnus Moehr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes