Hi,

I have a QTableView and set model QSqlQueryModel. I reimplement the function virtual data( ) and is functioning properly. The problem is that the first line is never applied what determines the method. How can I fix it?

Qt Code:
  1. QVariant ChequesRecModel::data(const QModelIndex &idx, int role) const
  2. {
  3. QVariant v = QSqlQueryModel::data(idx, role);
  4.  
  5. if ((idx.row()) && (role == Qt::BackgroundRole) &&
  6. (index(idx.row(), 9, idx.parent()).data().toInt() == 0))
  7. {
  8. return QVariant(QColor(Qt::yellow));
  9. }
  10.  
  11. return (v);
  12.  
  13. }
To copy to clipboard, switch view to plain text mode 

Thanks,

Marcelo E. Geyer
Brazil/RS