MCPcopy Create free account
hub / github.com/KDE/kdevelop / readStyleSheet

Method readStyleSheet

plugins/manpage/manpagedocumentation.cpp:67–76  ·  view source on GitHub ↗

* Read the file contents and return it wrapped in a <style> HTML element. * * @return The <style> HTML element or an empty string in case of error. * * @note Referencing a local file via absolute path or file:// URL inside a <link> * HTML element does not work because Qt WebEngine forbids such file system access. * A comment under QTBUG-5

Source from the content-addressed store, hash-verified

65 * during back/forward web history navigation, so such navigation loads unstyled pages.
66 */
67 static QString readStyleSheet(const QString& fileName)
68 {
69 QFile file(fileName);
70 if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
71 qCWarning(MANPAGE) << "cannot read CSS file" << fileName << ':' << file.error() << file.errorString();
72 return QString();
73 }
74 const auto cssCode = file.readAll();
75 return styleElementWithCode(cssCode, fileName);
76 }
77
78 /**
79 * Get the URL contents and return it wrapped in a &lt;style&gt; HTML element.

Callers

nothing calls this directly

Calls 4

QStringClass · 0.70
openMethod · 0.45
errorMethod · 0.45
errorStringMethod · 0.45

Tested by

no test coverage detected