Lost QTableWidget's ability to use StyleSheet
-
I have a QTableWidget (Qt Creator 4.14.2) that refuses to be styled. This is the code I'm using, code that worked like a charm last year when I was using Qt. But now, it's dead.
ui->tableWidget_Customers->setStyleSheet("alternate-background-color: #d3eaea;"); ui->tableWidget_Customers->horizontalHeader()->setStyleSheet ("QHeaderView::section { color: white; background-color:teal }"); ui->tableWidget_Customers->verticalHeader()->setStyleSheet ("QHeaderView::section { color: white; background-color:teal }");
I've noticed this about Qt: If it works today, just wait for tomorrow and it won't. They have a knack of "fixing" what isn't broken.
-
Hi,
Which version of Qt are you using exactly ?
Can you provide a minimal compilable example that shows that behaviour ? -
@SGaist - This is what I have:
{noformat} Qt 5.15.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6)) on "xcb" OS: Linux Mint 20.2 [linux version 5.4.0-80-generic] Environment: QT_ACCESSIBILITY="1" QT_QPA_PLATFORMTHEME="qt5ct" Features: QT_NO_EXCEPTIONS Library info: PrefixPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt DocumentationPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/doc HeadersPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/include LibrariesPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/lib LibraryExecutablesPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/libexec BinariesPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/bin PluginsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/plugins ImportsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/imports Qml2ImportsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/qml ArchDataPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt DataPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt TranslationsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/translations ExamplesPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/examples TestsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/tests SettingsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt
If needed, I'll create a minimal-usage scenario.
-
Yes a minimal compilable example will be a good thing.
Are you using your distribution provided Qt or one that you installed using the online installer ?
-
@SGaist - I got it from the Qt website. When I installed it, I watched it use my default Qt e-mail address and password before downloading myriad files.
As for the minimal asking, I just determined this isn't a Qt issue. Let me explain.
I don't use Qt's editor. I use CLion instead. When I run this in Qt (which I never do), the styling works fine. However, when I run it in CLion, the app takes on my system-wide theme. So I'm thinking this may be a CLion issue, since the styling works perfectly when I run the app out of Qt Creator. I hate days like this :D