BINARY INCOMPATIBLE CHANGE

make it possible to use the context menu event hack with non-Plasma::Widgets.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=765005
This commit is contained in:
Aaron J. Seigo 2008-01-22 23:39:15 +00:00
parent 0dfb81a617
commit 11f9ad3064
2 changed files with 17 additions and 6 deletions

View File

@ -338,7 +338,13 @@ void Widget::resize(qreal w, qreal h)
Widget *Widget::parent() const
{
QGraphicsItem *parent = parentItem();
return parent(this);
}
Widget *Widget::parent(const QGraphicsItem *item)
{
Q_ASSERT(item);
QGraphicsItem *parent = item->parentItem();
while (parent) {
Widget *parentWidget = dynamic_cast<Widget *>(parent);

View File

@ -217,6 +217,11 @@ public:
*/
Q_INVOKABLE Widget *parent() const;
/**
* @return the Plasma::Widget parent for a given QGraphicsItem
*/
static Widget *parent(const QGraphicsItem *item);
/**
* Add another Plasma::Widget as a child of this one.
* @param widget the widget to reparent to this Plasma::Widget.
@ -287,6 +292,11 @@ public:
*/
QPoint popupPosition(const QSize s) const;
/**
* Reimplemented from QGraphicsItem
*/
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* Paints the widget
@ -296,11 +306,6 @@ protected:
*/
virtual void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
/**
* Reimplemented from QGraphicsItem
*/
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void setSize(qreal width, qreal height);
void setSize(const QSizeF& size);