Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84909 Use bindable QProperty in Qt QML classes
  3. QTBUG-85033

Q(Notified)Property: Consider supporting comparison policies

    XMLWordPrintable

Details

    • Technical task
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • None
    • None

    Description

      QProperty (or rather QPropertyValueStorage) uses operator== to compare the new and the old value (for instance in setValueAndReturnTrueIfChanged). While this is fine in most cases, there are some where this behavior is questionable: Consider for instance QProperty<float>. When comparing floating point numbers, we often do not want strict equality, but rather the behaviour of qFuzzyCompare.

      Currently the only way to support custom comparisons for the type T in QProperty<T> is to create a wrapper struct around T, and to give it a comparison operator with the desired properties. However, the property does not return and take T in that case, but aforementioned wrapper, causing issues down the line.

      As a way to avoid this, we might want to add a comparison policy template parameter to QProperty.

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            fabiankosmale Fabian Kosmale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes