c++ - Editing QSS Stylesheet programmaticly -


well title explain issue have. want have qss stylesheet in specific folder. , want edit selected elements gui, programmatically. since qt doesn't support sass or less, need "manually". have until read qss file , few if statments can value of each element placed on qss file.

qtextstream in(qssfile); line = in.readline(); if(line.startswith("qdialog")) {      int start = line.indexof("{") + 1;      int end = line.indexof("}", start);      qdebug() << "qdialog" << line.mid(start, end - start); //"background-color: #404040;" } 

i read line , if user changes values on gui, save new ones. of course 1 isn't best/right solution how can make better solution issue have?

update 1: sample code have added may work, seems "junk" code 7-8 if statements each line. need if can set variables each elements in stylesheet such as:

qdialog{     background-color: @dialogbackgroundcolor;     min-width: @dialogminwidth; } 

by can set values temp stylesheet , apply it.

there terrible asymmetry between dynamic c++ setters , getters several (but far all) properties can set via qss.

to make problem worse, noticed, there no decent way edit active stylesheet other refreshing whole thing, means reloading everything. top off, there no easy programmatic way edit stylesheet once loaded. it's structured string, , parsing , modifying it, need resort boilerplate code, written you.

not using stylesheets isn't option either, various properties cannot set without them.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -