0

I want to know is it possible to make a stylesheet to make the contents in selected row bold.

i am using self.tw.setSelectionBehavior(QAbstractItemView.SelectRows) to set table to select entire row instead of cell. But i dont want any backgroung color to be changed instead it font should be bold.

How can i achieve this....?

Rao
  • 2,902
  • 14
  • 52
  • 70

2 Answers2

3

This is a python style code

font = QFont()
font.setBold(True)
self.ui.tableWidget.item(row_index, col_index).setFont(font)
Piccolo
  • 31
  • 2
0

In C++, we would create an onTableEdited() slot, connect it to the itemSelectionChanged() event, and then use table->item(x,y)->setFont() with something like

QFont font;
font.setBold(true);
font.setWeight(75);

You can also set a QTableWidget to only allow the selection of rows.