[SOLVED]Blink text in table
-
I got at tableview with items from a model.
Some of the rows should "Blink"
Just like in html and the Blink tagI Use a QBrush (myBlink) to set the color of the text.
In a timerevent I simple change the Qbrush (myBlink) color but nothing happens.
I know that the timerevent runs.
I have tried to repaint the tabelview but nothing happens.
is it possible to do like this:
Maybe i should use the paintevent or something;
pls help -
if you have a custom model (so using the QTableView, not QTableModel), you could change the data in the model and send dataCHanged signal. If you use the widgets style (QTableWidget) you can change the background color for the item in the widget. it should update immediatly.
-
I solved it in my own way.
@void Logs::BlinkTextRows(){
int row_count = model->rowCount(); int col_count = model->columnCount(); QModelIndex index; for( int i = 0; i < row_count; i++ ) { if (model->item(i,3)->data(Qt::DisplayRole).toString().compare("yes",Qt::CaseInsensitive) == 0) { if (model->item(i,4)->data(Qt::CheckStateRole) == Qt::Unchecked) { for (int j = 0;j < col_count;j++) { index = model->indexFromItem(model->item(i,j)); if (hidden) model->setData(index, myblink, Qt::ForegroundRole); else model->setData(index, myblink, Qt::ForegroundRole); }//for } //if model.. } //if compare }//For i if (hidden) hidden = false; else hidden = true;
}@
It wasn't so hard in the end