Change text color of QRadioButton text with style setStyleSheet without changing the check mark color
-
Hi
Oh. Well, i would try with test app and just one radio and set stylesheet to it and see.
It could also be Qt version difference. Especially if using Qt6.What windows ver are you on ?
even the "hole" looks slightly differnt.
-
well i use same version.
just 64 bit.5.15.2 still showing as black.
i did notice you are not calling constrcutor for QMaindows
class MainWindow : public QMainWindow { public: MainWindow() <<<< not calling base { setStyleSheet("QRadioButton { color: red};"); setCentralWidget(new ViewField); } };
Not that i think it should matter for this issue.
Also, if you do this in a default GUI project, it still did it ?
could you run this project ?
https://www.dropbox.com/s/1ecbob3kwz59l0n/colorme.zip?dl=0 -
@Palli: The first image with the red indicator is the
Windows
style, the second one isWindowsVista
. It's clearly visible because the current style (vista) doesn't draw 3D-effects but is flat. -
@Christian-Ehrlicher
Ahh you're a hawk eye!
So somehow the WindowsVista gets loaded ? -
@mrjj WindowsVista is the correct (default) one. Don't know if this was (is?) compilable with MinGW though.
-
@Christian-Ehrlicher
But we both use the same visual studio 2019 compiler and his sample on my pc,
uses the flat version and does not show as red but on his pc with the same Qt version and same compiler uses the
"3d" one and get red dot.
So not sure how we can differ considering he is on win 10 too. -
Don't know why the windowsvista style is not loaded - it's a plugin.
-
Hi Could you please add
#include <QStyleFactory>
#include <QDebug>int main(int argc, char *argv[]) { QApplication a(argc, argv); qDebug() << QStyleFactory::keys().join(" "); MainWindow mw; mw.show(); return a.exec(); }
to your 5.15.2 project and see what it lists.
for me its
"windowsvista Windows Fusion" -
@mrjj When I print out the keys from the style factory I get this:
Ran your Colorme and get this:
I use cmake to generate visual studio solution file. Maybe that is the root cause of my issues?@Christian-Ehrlicher
I don't know if it is relevant but I manually copy the .dlls I need the run the executables:
Since there windows vista style is not being loaded I wonder if there a .dll I missed? -
-
Thank you so much for your help, I have solved this but would definitely not been able to without your help.
The problem was that the .dll with the windowsvistat styles were not being loaded. Added styles/qwindowsvistastyle.dll to my build folder and it has fixed this issue.