c++ - Forcing a recalcuation of Qt Stylesheet appears to do nothing -


using stylesheets i'm trying change window's style, including children.

all children named, using setobjectname , stylesheet uses same name change style of named widgets (as few extract never needs changed). i'm recalculating stylesheet first inserting values std::map, mapping names, such qwidget#hello!hover, set of key-value pairs, such background-color #0f0f0f. i.e. ["qwidget#hello!hover"]["background-color"] = "#0f0f0f", 1 entry.

when stylesheet map changed recalculate entire stylesheet , set using setstylesheet on main widget, adding /* */ @ top (supposedly, should force recalculation of stylesheet). however, doesn't appear @ all.

doing this, in constructor of main widget works fine, doesn't once it's been set @ first.

the stylesheet calculate valid , entries ordered in way expect to, widgets have expected names , since works first time i'm setting it, suspect problem either new stylesheet has no effect or has no effect on children.

i'm using qt 5.4 (old shitty crap software that's developed qt3) on windows 10.

how can fix this?

i fixed problem setting stylesheet on children of main widget. after calculating new stylesheet, , storing in qstring, named stylesheet, used:

qlist<qwidget*> children = findchildren<qwidget*>();  (qlist<qwidget*>::iterator child = children.begin(); child != children.end(); ++child);     (*child)->setstylesheet(stylesheet); 

and worked charm. changes rare , there aren't whole lot of stuff in window, cost of doing isn't big of deal -- i'm sure can done more effeciently.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -