I have QT version 4.5.3. Does it support @import()? I'm trying to import another css file into my css file I have cssA.css and cssB.css in the same folder. I import cssA.css in cssB.css by using @import(:/cssA.css); but it doesn't seem to work. Can anybody tell me what's wrong?
3 Answers
I didn't find a good answer myself, so I manually concatenate multiple stylesheets to emulate 'importing'. For example, in C++:
QApplication a(argc, argv);
// Load stylesheets
QString finalCss;
QFile baseCssFile(":/Common/Theme.css");
if (baseCssFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
finalCss.append(baseCssFile.readAll().data());
}
QFile cssFile(":/CustomApp/CustomApp.css");
if (cssFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
finalCss.append(cssFile.readAll().data());
}
a.setStyleSheet(finalCss);
1 Comment
Cecil Curry
This is the only sane approach. Since Qt currently provides no support for importing one stylesheet into another, the onus is squarely on developers to manually do so.
</forlorn_sigh>Can you please try @import 'color_controls.css';
1 Comment
Cecil Curry
QSS ≠ CSS. Sadly, Qt provides no support for importing one stylesheet into another. See this open Qt feature request for further discussion.
I would advise taking a look at this website: Stylesheets
Syntax: @import ""; or @import url("");
For example:
@import "commonstylesheet.css";
1 Comment
Cecil Curry
QSS ≠ CSS. Sadly, Qt provides no support for importing one stylesheet into another. See this open Qt feature request for further discussion.