def createBackgroundSettings(self): s = QgsTextBackgroundSettings() s.setEnabled(True) s.setType(QgsTextBackgroundSettings.ShapeEllipse) s.setSvgFile('svg.svg') s.setSizeType(QgsTextBackgroundSettings.SizeFixed) s.setSize(QSizeF(1, 2)) s.setSizeUnit(QgsUnitTypes.RenderPixels) s.setSizeMapUnitScale(QgsMapUnitScale(1, 2)) s.setRotationType(QgsTextBackgroundSettings.RotationFixed) s.setRotation(45) s.setOffset(QPointF(3, 4)) s.setOffsetUnit(QgsUnitTypes.RenderMapUnits) s.setOffsetMapUnitScale(QgsMapUnitScale(5, 6)) s.setRadii(QSizeF(11, 12)) s.setRadiiUnit(QgsUnitTypes.RenderPixels) s.setRadiiMapUnitScale(QgsMapUnitScale(15, 16)) s.setFillColor(QColor(255, 0, 0)) s.setStrokeColor(QColor(0, 255, 0)) s.setOpacity(0.5) s.setJoinStyle(Qt.RoundJoin) s.setBlendMode(QPainter.CompositionMode_Difference) s.setStrokeWidth(7) s.setStrokeWidthUnit(QgsUnitTypes.RenderMapUnits) s.setStrokeWidthMapUnitScale(QgsMapUnitScale(QgsMapUnitScale(25, 26))) s.setPaintEffect( QgsBlurEffect.create({ 'blur_level': '6', 'enabled': '1' })) return s
def createBackgroundSettings(self): s = QgsTextBackgroundSettings() s.setEnabled(True) s.setType(QgsTextBackgroundSettings.ShapeEllipse) s.setSvgFile('svg.svg') s.setSizeType(QgsTextBackgroundSettings.SizeFixed) s.setSize(QSizeF(1, 2)) s.setSizeUnit(QgsUnitTypes.RenderPixels) s.setSizeMapUnitScale(QgsMapUnitScale(1, 2)) s.setRotationType(QgsTextBackgroundSettings.RotationFixed) s.setRotation(45) s.setOffset(QPointF(3, 4)) s.setOffsetUnit(QgsUnitTypes.RenderMapUnits) s.setOffsetMapUnitScale(QgsMapUnitScale(5, 6)) s.setRadii(QSizeF(11, 12)) s.setRadiiUnit(QgsUnitTypes.RenderPixels) s.setRadiiMapUnitScale(QgsMapUnitScale(15, 16)) s.setFillColor(QColor(255, 0, 0)) s.setStrokeColor(QColor(0, 255, 0)) s.setOpacity(0.5) s.setJoinStyle(Qt.RoundJoin) s.setBlendMode(QPainter.CompositionMode_Difference) s.setStrokeWidth(7) s.setStrokeWidthUnit(QgsUnitTypes.RenderMapUnits) s.setStrokeWidthMapUnitScale(QgsMapUnitScale(QgsMapUnitScale(25, 26))) s.setPaintEffect(QgsBlurEffect.create({'blur_level': '6', 'enabled': '1'})) return s
def createMaskSettings(self): s = QgsTextMaskSettings() s.setEnabled(True) s.setSize(5) s.setSizeUnit(QgsUnitTypes.RenderPixels) s.setSizeMapUnitScale(QgsMapUnitScale(1, 2)) s.setOpacity(0.5) s.setJoinStyle(Qt.BevelJoin) s.setPaintEffect(QgsBlurEffect.create({'blur_level': '2.0', 'blur_unit': QgsUnitTypes.encodeUnit(QgsUnitTypes.RenderMillimeters), 'enabled': '1'})) s.setMaskedSymbolLayers([QgsSymbolLayerReference("layerid1", QgsSymbolLayerId("symbol", 1)), QgsSymbolLayerReference("layerid2", QgsSymbolLayerId("symbol2", 2))]) return s
def createBufferSettings(self): s = QgsTextBufferSettings() s.setEnabled(True) s.setSize(5) s.setSizeUnit(QgsUnitTypes.RenderPixels) s.setSizeMapUnitScale(QgsMapUnitScale(1, 2)) s.setColor(QColor(255, 0, 0)) s.setFillBufferInterior(True) s.setOpacity(0.5) s.setJoinStyle(Qt.RoundJoin) s.setBlendMode(QPainter.CompositionMode_Difference) s.setPaintEffect(QgsBlurEffect.create({'blur_level': '10', 'enabled': '1'})) return s
# coding: utf-8 from qgis.core import QgsBlurEffect from qgis.gui import QgsTransformWidget transform_widget = QgsTransformWidget() transform_widget.setPaintEffect(QgsBlurEffect()) transform_widget.show()