From 1bc7ece06adac2d38f002de4f4671699be53193b Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Thu, 17 Oct 2019 10:00:48 +0200 Subject: [PATCH] Add styleSheetType to application reportStyleSheet --- .../core/auto_generated/qgsapplication.sip.in | 19 +++-- src/app/qgsrasterlayerproperties.cpp | 15 +--- src/core/qgsapplication.cpp | 84 +++++++++++++++---- src/core/qgsapplication.h | 27 ++++-- 4 files changed, 103 insertions(+), 42 deletions(-) diff --git a/python/core/auto_generated/qgsapplication.sip.in b/python/core/auto_generated/qgsapplication.sip.in index 0db3bd6bebf..741f17e9e24 100644 --- a/python/core/auto_generated/qgsapplication.sip.in +++ b/python/core/auto_generated/qgsapplication.sip.in @@ -76,6 +76,12 @@ to change due to centralization. %End public: + enum StyleSheetType + { + Qt, + WebBrowser, + }; + static const char *QGIS_ORGANIZATION_NAME; static const char *QGIS_ORGANIZATION_DOMAIN; static const char *QGIS_APPLICATION_NAME; @@ -503,20 +509,23 @@ Gets application icon Returns whether this machine uses big or little endian %End - static QString reportStyleSheet(); + static QString reportStyleSheet( const StyleSheetType &styleSheetType = StyleSheetType::Qt ); %Docstring -Returns a standard css style sheet for reports. +Returns a css style sheet for reports, the ``styleSheetType`` argument +determines what type of stylesheet is supported by the widget. Typically you will use this method by doing: QString myStyle = QgsApplication.reportStyleSheet(); textBrowserReport->document()->setDefaultStyleSheet(myStyle); +if you are using a QgsWebView you will need to manually inject +the CSS into a