AppletScript::shape()

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=824153
This commit is contained in:
Aaron J. Seigo 2008-06-25 00:33:46 +00:00
parent 4f25215729
commit 350bb8c48e
4 changed files with 30 additions and 0 deletions

View File

@ -1398,6 +1398,15 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
return QGraphicsWidget::itemChange(change, value); return QGraphicsWidget::itemChange(change, value);
} }
QPainterPath Applet::shape() const
{
if (d->script) {
return d->script->shape();
}
return QGraphicsWidget::shape();
}
QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
{ {
QSizeF hint = QGraphicsWidget::sizeHint(which, constraint); QSizeF hint = QGraphicsWidget::sizeHint(which, constraint);

View File

@ -727,6 +727,11 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
*/ */
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value);
/**
* Reimplemented from QGraphicsItem
*/
QPainterPath shape() const;
/** /**
* Reimplemented from QGraphicsLayoutItem * Reimplemented from QGraphicsLayoutItem
*/ */

View File

@ -80,6 +80,17 @@ QList<QAction*> AppletScript::contextualActions()
return QList<QAction*>(); return QList<QAction*>();
} }
QPainterPath AppletScript::shape() const
{
if (applet()) {
QPainterPath path;
path.addRect(applet()->boundingRect());
return path;
}
return QPainterPath();
}
void AppletScript::showConfigurationInterface() void AppletScript::showConfigurationInterface()
{ {
} }

View File

@ -98,6 +98,11 @@ public:
*/ */
virtual QList<QAction*> contextualActions(); virtual QList<QAction*> contextualActions();
/**
* Returns the shape of the widget, defaults to the bounding rect
*/
virtual QPainterPath shape() const;
public Q_SLOTS: public Q_SLOTS:
/** /**