diff --git a/panelsvg.cpp b/panelsvg.cpp index 931a947e4..1568474c3 100644 --- a/panelsvg.cpp +++ b/panelsvg.cpp @@ -129,7 +129,11 @@ void PanelSvg::setEnabledBorders(const EnabledBorders borders) PanelSvg::EnabledBorders PanelSvg::enabledBorders() const { - return d->panels[d->prefix]->enabledBorders; + if (d->panels.contains(d->prefix)) { + return d->panels[d->prefix]->enabledBorders; + } else { + return NoBorder; + } } void PanelSvg::setElementPrefix(Plasma::Location location) @@ -234,6 +238,15 @@ void PanelSvg::resizePanel(const QSizeF& size) d->panels[d->prefix]->panelSize = size; } +QSizeF PanelSvg::panelSize() const +{ + if (d->panels.contains(d->prefix)) { + return d->panels[d->prefix]->panelSize; + } else { + return QSize(-1, -1); + } +} + qreal PanelSvg::marginSize(const Plasma::MarginEdge edge) const { if (d->panels[d->prefix]->noBorderPadding) { diff --git a/panelsvg.h b/panelsvg.h index 110f29922..fbcae0afb 100644 --- a/panelsvg.h +++ b/panelsvg.h @@ -48,7 +48,8 @@ class PLASMA_EXPORT PanelSvg : public Svg /** * These flags represents what borders should be drawn */ - enum EnabledBorder { TopBorder = 1, + enum EnabledBorder { NoBorder = 0, + TopBorder = 1, BottomBorder = 2, LeftBorder = 4, RightBorder = 8, @@ -93,6 +94,11 @@ class PLASMA_EXPORT PanelSvg : public Svg */ void resizePanel(const QSizeF& size); + /** + * @returns the size of the panel + */ + QSizeF panelSize() const; + /** * Returns the margin size given the margin edge we want * @arg edge the margin edge we want, top, bottom, left or right