Answer the question
In order to leave comments, you need to log in
How to change text alignment in QTableView table headers using CSS?
Hello. I use a program from Siemens for building SCADA systems (WinCC OA), which is built on Qt. You cannot directly work with the Qt library in it, but you can change the display of graphic objects using CSS. How to define text alignment in QTableView table headers using only CSS.
Tried like this:
QTableView QHeaderView::section {
text-align: center;
}
Answer the question
In order to leave comments, you need to log in
Got a stackoverflow response:
Judging by this jira , this bug is not closed yet.
But there is a solution through the properties of qt-objects:
QHeaderView {
qproperty-defaultAlignment: AlignLeft;
}
Tried it in my program (WinCC OA): only works partially. I tried it in QSS Editor - it works. So this advice can be considered a solution. But if someone can say something specifically about WinCC OA, then I will be glad to hear it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question