I know that I can put HTML and CSS, and QGIS will render such code but some CSS styles like grid and pseudo-selectors are not working. Thus I wanted to know what level of support is there especially for the newer web standards.


It depends on your QGIS version and the Qt toolkit version it's based on. First look into Help > About to retrieve the Qt version. If you are referring to a print layout, QGIS uses QWebView (HTML frame items - QgsLayoutItemHtml) and QWebPage widgets (HTML label items - QgsLayoutItemLabel) to render HTML. When I look into the source code (https://github.com/qgis/QGIS/) I can find references of QTextBrowser (QgsWebView) and QTextDocument (QgsTextAnnotation) as well that only support a limited subset of HTML4: https://doc.qt.io/qt-5/richtext-html-subset.html

Maybe @NyallDawson can jump in and give a detailed answer?

  • For which parts is QWebView used and for which parts QLabel? Aug 30 '21 at 6:22
  • @Matthias good question, I'm sure you know the right answer :-) QWebView is used for all HTML frames, and QLabel was a pure guess of mine (for Label items). Maybe you could show us how to retrieve the Qt widget class names from the QGIS widgets?
    – christoph
    Aug 30 '21 at 8:13
  • 1
    You can have a look at github.com/qgis/QGIS ;-) With respect to your answer, I think the question needs clarification where in QGIS it is asking for. Inside your answer the link could be put in context (does it apply for labels or web view) Aug 30 '21 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.