estanisgeyer
5th May 2008, 20:33
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?
QVariant ChequesRecModel::data(const QModelIndex &idx, int role) const
{
QVariant v = QSqlQueryModel::data(idx, role);
if ((idx.row()) && (role == Qt::BackgroundRole) &&
(index(idx.row(), 9, idx.parent()).data().toInt() == 0))
{
return QVariant(QColor(Qt::yellow));
}
return (v);
}
Thanks,
Marcelo E. Geyer
Brazil/RS
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?
QVariant ChequesRecModel::data(const QModelIndex &idx, int role) const
{
QVariant v = QSqlQueryModel::data(idx, role);
if ((idx.row()) && (role == Qt::BackgroundRole) &&
(index(idx.row(), 9, idx.parent()).data().toInt() == 0))
{
return QVariant(QColor(Qt::yellow));
}
return (v);
}
Thanks,
Marcelo E. Geyer
Brazil/RS