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

QSqlRelationalTableModel doesn't follow relations on the first column of a table

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 4.7.3
    • Fix Version/s: 5.0.0
    • Component/s: SQL Support
    • Labels:
      None
    • Environment:
      found on linux qt 4.7.3
    • Commits:
      978ccece892431998af08e880b1454849af9e9c9

      Description

      QSqlRelationalTableModel doesn't follow relations on the first column of a table. The DisplayRole and the EditRole for indexes on column 0 are always the same.

      in

      QVariant QSqlRelationalTableModel::data(const QModelIndex &index, int role) const
      {
          Q_D(const QSqlRelationalTableModel);
      
          if (role == Qt::DisplayRole && index.column() > 0 && index.column() < d->relations.count() &&
                  d->relations.value(index.column()).isValid()) {
      
      		//do work
          }
          return QSqlTableModel::data(index, role);
      }
      

      the test should be

      if (role == Qt::DisplayRole && index.column() >= 0 && index.column() < d->relations.count() &&
                  d->relations.value(index.column()).isValid())
      

        Attachments

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

          Activity

            People

            Assignee:
            zhongle honglei zhang
            Reporter:
            mementomori Filippo Santovito
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes