[solved] QTableWidgetItem set StyleSheet
-
You can customize the style of single cell using method "setData":http://developer.qt.nokia.com/doc/qt-4.8/qtablewidgetitem.html#setData. Try with something like:
@
table.item(3, 2).setData(Qt.BackgroundRole, QVariant(QColor(Qt::yellow)) );
@ -
thanks, but this unit only color, and how to impose a completely separate style to a cell ...
something like
@item(3,2).setStyleSheet("border:1px solid grey; border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;")@need to do a completely different style from the cell ...
-
[quote author="BlackJack" date="1326704668"]thanks, but this unit only color, and how to impose a completely separate style to a cell ...
something like
@item(3,2).setStyleSheet("border:1px solid grey; border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;")@need to do a completely different style from the cell ...[/quote]
This is not possible by styling.
It can only be achieved by creating a delegate which does customized painting. But take care, if you change borders and margins, the size of the cell might change so you have to adopt the rest of the row / rolumn.