Hey guys, how can I change the color of a text in a QTreeWidget??
I want some lines displayed in red, I used:
void QWidget::setForegroundRole ( QPalette::ColorRole role )
but nothing happened!
I'm using Qt-4.3 in linux.
Hey guys, how can I change the color of a text in a QTreeWidget??
I want some lines displayed in red, I used:
void QWidget::setForegroundRole ( QPalette::ColorRole role )
but nothing happened!
I'm using Qt-4.3 in linux.
See QTreeWidgetItem::setForeground.
Regards
Thanks but...
I put this in the code:
if (credito_radio->isChecked()){
QBrush brush;
brush.setColor(Qt::red);
item->setForeground(5,brush);
saldo_doubleSpin->setValue(saldo_doubleSpin->value()+valor_doubleSpin->value());
aux.setNum(1,10);
item->setText(5,aux);
}
but the text still in black!!
I'm doing something wrong?
Well, do you have 6 columns in your tree widget?
Column count starts at 0.
Try:
Qt Code:
item->setForeground(0,Qt::red);To copy to clipboard, switch view to plain text mode
I just tested it and it works.
regards
Ohh guy, thank you:
Well, do you have 6 columns in your tree widget?
Column count starts at 0.
after you said it I reviewed the code and I could see, the column 5 isn't visible!! I was doing the setForeground in the wrong column!! hehe
Bookmarks