Change color of headers
-
wrote on 1 Feb 2023, 14:49 last edited by
Hi everybody! I work with QTableWidget and ran into a problem, how to change the style of the vertical header? I want to get something like this:
I have interest for column with green text. Can I change the style of vertical header on such as in the first column or no? If yes, how? I tried set StyleSheet, but it's not work how I need. -
Hi everybody! I work with QTableWidget and ran into a problem, how to change the style of the vertical header? I want to get something like this:
I have interest for column with green text. Can I change the style of vertical header on such as in the first column or no? If yes, how? I tried set StyleSheet, but it's not work how I need.@Vlad02 said in Change color of headers:
I tried set StyleSheet, but it's not work how I need
Please show how.
Also, is it a QTableWidget or QTableView?
You need to set style sheet on vertical header. -
wrote on 1 Feb 2023, 14:58 last edited by
as jsulm said, set style sheet to vertical header
https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qheaderview -
@Vlad02 said in Change color of headers:
I tried set StyleSheet, but it's not work how I need
Please show how.
Also, is it a QTableWidget or QTableView?
You need to set style sheet on vertical header.wrote on 1 Feb 2023, 15:23 last edited by@jsulm Set StyleSheet:
QHeaderView *header = ui->memoryTable->verticalHeader(); header->setStyleSheet("background-color: black;" "color: green;" "border: none;"); ui->memoryTable->setVerticalHeader(header); ui->memoryTable->verticalHeader()->setVisible(true);
And I use QTableWidget. Color of text changed, but I get next:
-
as jsulm said, set style sheet to vertical header
https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qheaderview
1/5