Using HSV for background-color?
Solved
General and Desktop
-
Hello fellow QT'ers,
I've looked at the documentation and can't seem to find a way to use HSV values instead of RGB when declaring a background-color. Is this even possible? I've seen that QColor has a SetHSV method but how do you pass that into the background-color?
Thanks in advance.
-
See https://doc.qt.io/qt-5/stylesheet-reference.html at the Color property
-
Hi Christian, I took a look and only see a hardcoded color name "red".
Here's what I've tried so far:QColor color; color.setHsv(206, 17, 97); this.setStyleSheet("QPushButton:checked { background-color: color; border: none }");
and it's just compiling to a button with dark background.
-
This code can not work. You pass a string to setStyleSheet so it can't catch the value of 'color'.
-
@SimonSchroeder that worked!