Hi,
With Qt 4.8, I used to rely on the “@import” statement to import a CSS file into another, but for some (very annoying) reason it doesn’t work anymore in Qt 5 (see http://qt-project.org/forums/viewthread/23746/ [qt-project.org]). So, I thought I would do things differently, but now I am facing another unrelated issue.
Basically, my application’s help is made of a series of HTML files which are styled using CSS. Those HTML files are used both on my application’s website and within my application. In some HTML files, I have some code which I have styled in a certain way, the idea being not to show that code on my application’s website while showing it within my application.
For this, I have a very simple CSS rule [1]:
span.myapp {
display: none;
}
So, this means that by default (i.e. on my application’s website), the code is not shown. Now, in my application, I want to see the code, so I thought I would use something like:
myWebView->page()->settings()->setUserStyleSheetUrl(QUrl::fromLocalFile(myLocalCssFile));
myLocalCssFile points to a file which has the following contents [2]:
span.myapp {
display: inline;
}
So, yes, some very simple code to show the code within my application. Yet, it doesn’t work!
Interestingly (so to speak!), if I completely remove [1] and replace [2] with:
span.myapp {
color: rgb(255, 0, 0);
}
Then, the code will be shown in all cases, except that within my application it will be in red.
So… it would seem that for (yet) some (more very annoying) reason, something is broken in Qt 5… or have I done something wrong. Hopefully, it’s the latter…
Anyway, anyone any idea?
Cheers, Alan.
↧