give some shape to the icon

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=760002
This commit is contained in:
Aaron J. Seigo 2008-01-11 18:17:24 +00:00
parent 0cac630a79
commit 3d6c1c5527
2 changed files with 14 additions and 0 deletions

View File

@ -354,6 +354,15 @@ bool Icon::drawBackground() const
return d->drawBg;
}
QPainterPath Icon::shape() const
{
if (d->currentSize.width() < 1) {
return QGraphicsItem::shape();
}
return roundedRectangle(QRectF(QPointF(0.0, 0.0), d->currentSize).adjusted(-2, -2, 2, 2), 10.0);
}
QSizeF Icon::Private::displaySizeHint(const QStyleOptionGraphicsItem *option, const qreal width) const
{
if (text.isEmpty() && infoText.isEmpty()) {

View File

@ -191,6 +191,11 @@ public:
*/
bool drawBackground() const;
/**
* reimplemented from QGraphicsItem
*/
QPainterPath shape() const;
public Q_SLOTS:
/**
* Sets the appearance of the icon to pressed or restores the appearance