What I want to do is that I have a QSS stylesheet in specific folder. And I want to edit selected elements from GUI, programmatically. Since QT doesn't support SaSS or LeSS, I need to do this "manually". What I have until now is read a qss file and with few if statments I can get the value of each element that 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 the line and if user changes the values on the gui, I save the new ones. of course this one isn't the best/right solution but how I can make a better solution to this issue I have?
Update 1: the sample code I have added it may work, but seems like a "junk" code with 7-8 if statements for each line. What I need is if I can set variables to each elements in stylesheet such as:
QDialog{
background-color: @dialogBackgroundColor;
min-width: @dialogMinWidth;
}
by that I can set the values into the temp stylesheet and apply it.