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

Make dataChanged signal actually pass a QVector<int> filled with changed data roles as a parameter

    XMLWordPrintable

Details

    • d02e7b46a126181a7ede302bfd247b872ccce0de

    Description

      QAbstractItemModel class introduces a crucial dataChanged signal which passes two QModelIndex objects representing the span and a QVector<int> of data roles which were changed.

      Qt's QTableWidget is supposed to cover the majority of simple use cases and is provided so that users do not have to write view and model implementations on their own if the task at hand is not demanding enough. The problem is that its underlying QTableModel implementation does not use the roles parameter of dataChanged signal. Thus it is impossible to determine which data role was changed when a QTableWidgetItem changes. I reckon that being able to pinpoint the data role that led to emitting the itemChanged and dataChanged signals is very important.

      Without knowing the role it is impossible to write slots that react only to eg. item's text change – quite a frequent case – or user's own data.

      After reading the qtablewidget.cpp I see that the role which is supplied to QTableWidgetItem::setData method call is dropped and never reaches QTableModel::itemChanged which in turn emits the dataChanged signal with a default-initialized QVector<int> as the roles parameter.

      Would you consider implementing roles parameter support in dataChanged methods of all the data view-model classes?

      Attachments

        For Gerrit Dashboard: QTBUG-48295
        # Subject Branch Project Status CR V

        Activity

          People

            chehrlic Christian Ehrlicher
            idadru Karma
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes