I use the program from Siemens ( WinCC OA ), which is built on Qt . Directly, it is impossible to work with the Qt library in it, but you can change the display of graphic objects using CSS . How, using only CSS , to determine the alignment of the text in the headings of the table QTableView .

I tried this:

  QTableView QHeaderView::section { text-align: center; } 

And does not work.

    1 answer 1

    Judging by this jire , this bug is not closed yet.

    But there is a solution through the properties of qt-objects:

     QHeaderView { qproperty-defaultAlignment: AlignLeft; } 
    • Checked in QSS Editor - works. But unfortunately, it does not fully work in my program. But apparently, these are some bugs or features of the program that I use. So your answer can be considered a solution to this problem. - Max Lich
    • Well, what's the QSS Editor? Is it in Qt Creator? - gil9red
    • This is a separate program: QSS Editor 0.6.0 - Max Lich