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

QComboBox::findData behavior change undocumented or unintended

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.3.1
    • None

    Description

      With 4a69cd7f7 (from QTBUG-84636), QVariants were changed to not compare between types anymore as documented in the commit. As a result of that, QAbstractItemModel::match and QComboBox::findData change behavior as well, with QComboBox::findData calling QAbstractItemModel::match. In this case however, the documentation for these functions does not seem to reflect the QVariant behavior change.

      It is unclear if the behavior change in QAbstractItemModel::match and QComboBox::findData is undocumented, implied with the QVariant change, or unintended.

      Simple reproducer:

          QComboBox *combo = new QComboBox(this);
          combo->addItem("Text", 50);
      
          QByteArray byteArray = "50";
          int idx = combo->findData(byteArray);
          if(idx == 0)
              std::cout << "Found. Qt 5" << std::endl;
          else if (idx == -1)
              std::cout << "Not found. Qt 6" << std::endl;
      

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            rytoex Ryan Foster
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes