diff --git a/panelsvg.cpp b/panelsvg.cpp index 2a351ff76..fd43cfff5 100644 --- a/panelsvg.cpp +++ b/panelsvg.cpp @@ -153,6 +153,13 @@ void PanelSvg::setElementPrefix(Plasma::Location location) d->location = location; } +bool PanelSvg::hasElementPrefix(const QString & prefix) const +{ + //for now it simply checks if a center element exists, + //because it could make sense for certain themes to not have all the elements + return hasElement(prefix + "-center"); +} + void PanelSvg::setElementPrefix(const QString & prefix) { const QString oldPrefix(d->prefix); @@ -364,8 +371,7 @@ void PanelSvg::Private::generateBackground(PanelData *panel) } p.drawTiledPixmap(QRect(panel->leftWidth, panel->topHeight, - contentWidth, contentHeight), - prefix + "center"), center); + contentWidth, contentHeight), center); } } else { if (contentHeight > 0 && contentWidth > 0) { diff --git a/panelsvg.h b/panelsvg.h index 8b70812c0..2d37867ea 100644 --- a/panelsvg.h +++ b/panelsvg.h @@ -133,6 +133,13 @@ class PLASMA_EXPORT PanelSvg : public Svg */ void setElementPrefix(const QString & prefix); + /** + * @return true if the svg has the necessary elements with the given prefix + * to draw a panel + * @arg prefix the given prefix we want to check if drawable + */ + bool hasElementPrefix(const QString & prefix) const; + /** * Returns the prefix for SVG elements of the PanelSvg * @return the prefix