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

Variant alias properties cannot be converted

XMLWordPrintable

      If you define a property aliasing a variant property, the alias property cannot be converted to anything, which makes it pretty useless. Simple example:

      import QtQuick 2.0
      Rectangle {
          width: 800
          height: 600
          Item {
              id: item
              property variant color: Qt.rgba(1, .5, 0, 1)
          }
          property alias colorAlias: item.color
          color: colorAlias // Doesn't work: "Unable to assign QVariant to QColor"
          //color: item.color // Works as expected
      }
      

      This works in Qt 4, but fails in Qt 5, both with Qt Quick 1 and 2.

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

            aakenned Aaron Kennedy
            kkalland Kim Motoyoshi Kalland (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes