diff --git a/panelsvg.cpp b/panelsvg.cpp index cd3bdb03f..ac26388b5 100644 --- a/panelsvg.cpp +++ b/panelsvg.cpp @@ -379,7 +379,7 @@ void PanelSvg::paintPanel(QPainter* painter, const QRectF& target, const QRectF& Q_ASSERT(panel->cachedBackground); } - painter->drawPixmap(target, *(panel->cachedBackground), source); + painter->drawPixmap(target, *(panel->cachedBackground), source.isValid() ? source : target); } void PanelSvg::paintPanel(QPainter* painter, const QPointF& pos) diff --git a/panelsvg.h b/panelsvg.h index 9770032f7..cbe0cf6ba 100644 --- a/panelsvg.h +++ b/panelsvg.h @@ -229,7 +229,8 @@ class PLASMA_EXPORT PanelSvg : public Svg * @arg target the target rectangle on the paint device * @arg source the portion rectangle of the source image */ - Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& target, const QRectF& source); + Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& target, + const QRectF& source = QRectF()); /** * Paints the loaded SVG with the elements that represents the border