Hi!
I am experimenting with a subclass of QSqlQueryModel. Since I wanted to change the background color in the ListView, I reimplemented the data method
{
if( role == Qt::BackgroundColorRole )
{
return Qt::green;
}
else if( role == Qt::DisplayRole )
{
return record( item.row() ).value( item.column() );
}
}
QVariant BrowseWoTableModel::data( const QModelIndex &item, int role ) const
{
if( role == Qt::BackgroundColorRole )
{
return Qt::green;
}
else if( role == Qt::DisplayRole )
{
return record( item.row() ).value( item.column() );
}
return QVariant();
}
To copy to clipboard, switch view to plain text mode
This works for setting the background color, but fails in displaying the data.
What am I missing here?
//John
Bookmarks