Hi Rui:
QSS stylesheets require absolute paths for images.
I have decided to add the VTQ_PATH variable to the VTQ format.
This allows you to include image backgrounds. Also extra icons for QT elements such as the arrows of the QAbstractSpinBox, QCombox, etc.
Example:
qtractorPluginListView {
background: url(VTQ_PATH/Tecnico_Images/shelves.png);
}
This greatly expands the possibilities of customizing Qtractor.
For example, currently the fader handles in my theme are made with gradients. With this implementation it is possible to create a perfectly detailed graph, with shadows, perspectives, etc.
I have implemented it and it works:
...qtractor.cpp linea 577 // Custom style sheet (QSS)... if (!options.sCustomStyleSheet.isEmpty()) { QFile file(options.sCustomStyleSheet); if (file.open(QFile::ReadOnly)) { QFileInfo fileInfo(options.sCustomStyleSheet); QString vtqPath = fileInfo.path(); QString qssContent = QString::fromUtf8(file.readAll()); qssContent.replace("VTQ_PATH", vtqPath); app.setStyleSheet(qssContent); file.close(); } }
I have a question, and it is if it would still work with accents and characters in paths from other languages.
How would you feel about adding it officially to Qtractor?
re. VTQ_PATH variable implementation...
hi, I think having it as a special named variable or symbol is not the right thing: it would make it locked down to your VTQ offering :/
what about making all the
url
paths relative to the .qss file location (ie.fileInfo.absolutePath()
in above code) ? and then on load, replace allurl(
rpath)
occurrences to finalurl( + fileInfo.absolutePath() + '/' +
_ rpath_)
?get the idea?
Perfect as you say
Yes, it is a cleaner solution.
In fact, it would work just as expected (as it does in CSS where the reference path is always the CSS file, and not the application or "index").
That also saves me from having to document it.
It just didn't occur to me that there was already a recognizable pattern for making the changes: url(
This works:
Example QSS:
qtractorPluginListView {
background: url(Tecnico_Images/shelves.png);
}
re. regex implementation...
hi,
as proposed, the
url(
relative/path)
tourl(
/absolute/path)
substitution is now in effect (using a regular expressions): qtractor >= 1.5.2.2git.dfd7acplease test && tell cheers
It works perfectly
Thank you so much
Add new comment