Make the SvgPanel position-aware
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=775234
This commit is contained in:
parent
7516d7ea30
commit
322faacbe7
16
svgpanel.cpp
16
svgpanel.cpp
@ -33,7 +33,7 @@ class SvgPanel::Private
|
|||||||
public:
|
public:
|
||||||
Private()
|
Private()
|
||||||
: bFlags(DrawAllBorders|ContentAtOrigin),
|
: bFlags(DrawAllBorders|ContentAtOrigin),
|
||||||
cachedBackground(0)
|
cachedBackground(0), pos(0,0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +46,7 @@ public:
|
|||||||
QPixmap *cachedBackground;
|
QPixmap *cachedBackground;
|
||||||
Svg *background;
|
Svg *background;
|
||||||
QSizeF panelSize;
|
QSizeF panelSize;
|
||||||
|
QPointF pos;
|
||||||
|
|
||||||
//measures
|
//measures
|
||||||
int topHeight;
|
int topHeight;
|
||||||
@ -105,6 +106,17 @@ SvgPanel::BorderFlags SvgPanel::borderFlags() const
|
|||||||
return d->bFlags;
|
return d->bFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SvgPanel::setPos(const QPointF& pos)
|
||||||
|
{
|
||||||
|
d->pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF SvgPanel::pos() const
|
||||||
|
{
|
||||||
|
return d->pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SvgPanel::resize(const QSizeF& size)
|
void SvgPanel::resize(const QSizeF& size)
|
||||||
{
|
{
|
||||||
if (!size.isValid() || size.width() < 1 || size.height() < 1 || size == d->panelSize) {
|
if (!size.isValid() || size.width() < 1 || size.height() < 1 || size == d->panelSize) {
|
||||||
@ -303,7 +315,7 @@ void SvgPanel::paint(QPainter* painter, const QRectF& rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//p2->drawPixmap(paintRect, *cachedBackground, paintRect.translated(-leftOffset,-topOffset));
|
//p2->drawPixmap(paintRect, *cachedBackground, paintRect.translated(-leftOffset,-topOffset));
|
||||||
painter->drawPixmap(rect, *d->cachedBackground, rect.translated(-leftOffset, -topOffset));
|
painter->drawPixmap(rect, *d->cachedBackground, rect.translated(-d->pos.x()-leftOffset,-d->pos.y()-topOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SvgPanel::updateSizes()
|
void SvgPanel::updateSizes()
|
||||||
|
12
svgpanel.h
12
svgpanel.h
@ -110,6 +110,18 @@ class PLASMA_EXPORT SvgPanel : public QObject
|
|||||||
*/
|
*/
|
||||||
qreal marginSize(const Plasma::MarginEdge edge) const;
|
qreal marginSize(const Plasma::MarginEdge edge) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the position of the SvgPanel
|
||||||
|
* @arg pos where it should be positioned at
|
||||||
|
*/
|
||||||
|
void setPos( const QPointF& pos );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the position of the SvgPanel
|
||||||
|
* @return the position
|
||||||
|
*/
|
||||||
|
QPointF pos() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paints the loaded SVG with the elements that represents the border
|
* Paints the loaded SVG with the elements that represents the border
|
||||||
* @arg painter the QPainter to use
|
* @arg painter the QPainter to use
|
||||||
|
Loading…
Reference in New Issue
Block a user