diff --git a/widgets/icon.cpp b/widgets/icon.cpp index b96b58b55..175525122 100644 --- a/widgets/icon.cpp +++ b/widgets/icon.cpp @@ -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()) { diff --git a/widgets/icon.h b/widgets/icon.h index ad21f649a..e882c8f5b 100644 --- a/widgets/icon.h +++ b/widgets/icon.h @@ -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