QSqlQueryModel text color
-
Hello. Can't find answer so I created this post.
I want to change text color in column A to (example) red if date in column B more than currentDate.
Already tried to reimplement QSQM::data(...) but seems it wasn't called.
Also tried to use model->setData(index, QColor(Qt::red), Qt::ForegroundColor)..There are any solutions instead using QStandardItemModel and fill it via while(qry.next()) ?
-
You are trying to customise the behaviour of individual cell based on the data. You need to write you customDelegate for this to make it work. Please look at how to write custom delegate and set the same for view.
-
Hi,
QSqlQueryModel is a read only model
You have two options here:
QStyledItemDelegate
QIdentityProxyModel -
Thanks a lot.
I'll try it.