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

Unexpected behaviour of QObject::setProperty

    XMLWordPrintable

    Details

    • Platform/s:
      Windows
    • Commits:
      64a560d977a0a511ef541d6116d82e7b5c911a92 e0c798742adbc984e71c0f65cc432101da5b9c52

      Description

      Setting a QObject property is not working as expected. If we execute the following commands:

      test.setProperty("a", "");

      test.setProperty("a", false);

      And then try to print value of "a", we get as "". Result expected here is false. 

      I checked the underlying code and observed that logic compares the old value to new value and updates only in these are different. but in this case, code treats "" as false, and don't update property value. May be QVariant::operator== needs to modified. 

      As a workaround, we can set property as invalid before setting it to false. 

      Attaching the sample project also. 

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            shmittal Shveta Mittal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes