PDA

View Full Version : QTableView default font and header sizes changes from Qt5.9 to Qt5.12



martakuki
12th February 2020, 12:16
Hi everybody!

I have a problem with QTableWidget fonts. I recently chaged from Qt5.9 to Qt5.12 version. With Qt5.9, the font of the QTableWidget used in my dialogs seems smaller than in Qt5.12. Due this change, lots of dialogs of my program have been deconfigured. I need to find a general solution to solve this, because the configuration of each QTableWidget used in my program could be a very hard work.
I attach some examples of tables. I can not modify the sizes of Dialogs to allow see the tables bigger. The only solution is reduce the font and header sizes, but preferently with a general solution. The same problem occours with QTreeWidget.

Thanks in advance.

ChrisW67
13th February 2020, 09:13
You should be able to set a stylesheet (https://doc.qt.io/qt-5/stylesheet-reference.html) at the application or top widget level. Perhaps something like:


qApp->setStyleSheet("QTableView { font-family: \"Times New Roman\"; font-size: 9pt }");

martakuki
14th February 2020, 10:34
You should be able to set a stylesheet (https://doc.qt.io/qt-5/stylesheet-reference.html) at the application or top widget level. Perhaps something like:


qApp->setStyleSheet("QTableView { font-family: \"Times New Roman\"; font-size: 9pt }");


Thank you!! It works!!;)