[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasma/widgets
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-01-22 23:39:16
Message-ID: 1201045156.477913.32018.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 765005 by aseigo:

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


 M  +7 -1      widget.cpp  
 M  +10 -5     widget.h  


--- trunk/KDE/kdebase/workspace/libs/plasma/widgets/widget.cpp #765004:765005
@@ -338,8 +338,14 @@
 
 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);
 
--- trunk/KDE/kdebase/workspace/libs/plasma/widgets/widget.h #765004:765005
@@ -218,6 +218,11 @@
     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 @@
     */
     QPoint popupPosition(const QSize s) const;
 
+    /**
+     * Reimplemented from QGraphicsItem
+     */
+    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
+
 protected:
     /**
      * Paints the widget
@@ -296,11 +306,6 @@
      */
     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);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic