Uploaded image for project: 'Qt Mobility'
  1. Qt Mobility
  2. QTMOBILITY-1416

QML Organizer Model does not emit modelChanged() signal properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 1.3.0
    • 1.1.1
    • Organizer
    • None
    • 3a677faee617ae6d6236812d85edb2af75d7ca3b

    Description

      The model does not emit modelChanged() signal when the underlying organizer store returns an empty item list.

      Example:
      1. initial fetch, model contains > 0 items>
      (modelChanged() emitted as expected)

      2. change any property that triggers fetchAgain() such that the underlying organizer store returns an empty list>
      (modelChanged() NOT emitted)

      Reason:
      In QDeclarativeOrganizerModel::requestUpdated, the modelChanged signal is only emitted if (!items.isEmpty()). I believe the signal should be moved out of the if statement.

      The modelChanged() signal is in fact redundant, because QAbstractListModel should emit signals properly whenever items are inserted, updated or removed. This requires proper use of QAbstractListModel::begin<operation> and QAbstractListMode::end<operation>. For maximum performance, I recommend using beginResetModel() and endResetModel() whenever the whole model is changed (e.g. in fetchAgain() when d->m_updatedItemIds.isEmpty()).

      Attachments

        Activity

          People

            w00t Robin Burchell
            bjnilsen Bjørn Erik Nilsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: