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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0
    • 4.7.3
    • SQL Support
    • None
    • found on linux qt 4.7.3
    • 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

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

        Activity

          People

            zhongle honglei zhang
            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