How to change button style sheet?
Solved
General and Desktop
-
-
Hi,
If you want some sort of editable stylesheet, you should make it's content a member variable so you can then modify it to match what you want.
-
What do you mean? Variable RGB colors instead of
yellow
? Where exactly is the problem?
The stylesheet can be treated as a regularQString
, so you can make use ofQString::args
.int value = 255; QString style("%1").args(value);
-
Hi
Its very unclear what you ask about , but after some coffee I realized you may be asking how to use
same syntax as in the first screen shotFor that you can use c++ raw strings syntax
the R"()" part.This allows you to have any text directly AS IS
QString Sheet = R"( QPushButton#pushButton { background-color: yellow; } QPushButton#pushButton:pressed { background-color: rgb(224, 0, 0); } QPushButton#pushButton:hover { background-color: rgb(224, 255, 0); })"; setStyleSheet(sheet);
-
@mrjj THANK YOU :))
Helped a lot!
1/5