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

Add validation mode for QProperties

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • Core: Object Model
    • None

      There is plenty of opportunity to get QProperties wrong. When formulating a QML binding in terms of other properties which have neither NOTIFY nor BINDABLE, one gets a warning like "QQmlExpression: Expression qrc:/main.qml:15:9 depends on non-NOTIFYable properties". When doing the same in C++, no error and no warning is generated. This will lead to bugs. To help people find these bugs, it would be nice to have a "validation mode":

      In "validation mode", properties evaluate in each read access. If the value changes, even though their dirty flag is not set, they generate an error.

      This validation mode could be implemented inside of ifdefs, then there is no overhead when it is unused. But then, using validation mode would require a recompile of QT.

      Or it could be steered by an environment variable. That would make the validation mode very usable (just run "QT_PROPERTIES_VALIDATION=1 ./myapplication") but every read access to a property having a binding would need to check this flag. Given that it has to check the dirty flag in each read anyway, the performance hit might be very small.

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

            fabiankosmale Fabian Kosmale
            andreasbuhr Andreas Buhr
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes