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

ListView rejects QList models

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.12.0
    • None
    • Linux/X11

    Description

       

      In the new 5.12 TableView the delegates of type ComboBox (and all other views) reject QVariant wrapped model values without notice (the QAbstactTableModel::data returns QVariant).
      In this case the view behaves as if no model is set.
      A workaround is to concat the wrapped list to an empty array.

      Is this the expected behavior, or should views warn if they can't convert values passed to them?
      Even better would be if the views would accept the QVariant wrapped list values just like JS arrays.

      Simplified example:

      ComboBox { //or ListView {
        //fails silently for values of QVariant::fromValue<QStringList>
        // and QVariant::fromValue<QList<int> > etc.
        model: myList;
      }
      ComboBox {
        //ugly workaround
        model: [].concat(myList);
      }
      

       

       

      Attachments

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              scientist_st Samuel Stirtzel
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes