contentsRect() function, consistent with QGraphicsWidget::contentsRect()
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=851491
This commit is contained in:
parent
053ba4f683
commit
1a321f0df1
16
panelsvg.cpp
16
panelsvg.cpp
@ -62,7 +62,7 @@ public:
|
||||
int leftWidth;
|
||||
int rightWidth;
|
||||
int bottomHeight;
|
||||
|
||||
|
||||
//margins, are equal to the measures by default
|
||||
int topMargin;
|
||||
int leftMargin;
|
||||
@ -313,6 +313,20 @@ void PanelSvg::getMargins(qreal &left, qreal &top, qreal &right, qreal &bottom)
|
||||
bottom = panel->bottomMargin;
|
||||
}
|
||||
|
||||
QRectF PanelSvg::contentsRect() const
|
||||
{
|
||||
QSizeF size(panelSize());
|
||||
|
||||
if (size.isValid()) {
|
||||
QRectF rect(QPointF(0, 0), size);
|
||||
PanelData *panel = d->panels[d->prefix];
|
||||
|
||||
return rect.adjusted(panel->leftMargin, panel->topMargin, -panel->rightMargin, -panel->bottomMargin);
|
||||
} else {
|
||||
return QRectF();
|
||||
}
|
||||
}
|
||||
|
||||
QBitmap PanelSvg::mask() const
|
||||
{
|
||||
PanelData *panel = d->panels[d->prefix];
|
||||
|
@ -118,6 +118,11 @@ class PLASMA_EXPORT PanelSvg : public Svg
|
||||
*/
|
||||
void getMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
|
||||
|
||||
/**
|
||||
* @return the rectangle of the center element, taking the margins into account.
|
||||
*/
|
||||
QRectF contentsRect() const;
|
||||
|
||||
/**
|
||||
* Sets the prefix (@see setElementPrefix) to 'north', 'south', 'west' and 'east'
|
||||
* when the location is TopEdge, BottomEdge, LeftEdge and RightEdge,
|
||||
|
Loading…
Reference in New Issue
Block a user