Qt6 topics merged with General

Suggestion for a setStyleSheet call for SVG

  • Hi,

    Just like how we can set a style sheet to the entire QApplication and all children inherit/override this, I suggest there should be a capability of setting a stylesheet to the Qt Svg module. All Svg images loaded would by default inherit these styles.

    I'm writing a dialog to browse thousands of SVG images and if they are using a single external CSS, the CSS gets parsed each time, when each SVG is rendered. This is bringing the performance down drastically.

    I did some hack in the QSvgHandler to cache this CSS, and thus greatly improving performance. But seriously a more elegant solution would be to set this at some root level. Not sure how useful this will be for other users .. but I feel this is a common scenario.

  • I actually modified the qsvghandler_p.h and am aware of the warning that this file could get modified without notice :)

Log in to reply