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

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/actions
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2008-04-21 21:26:42
Message-ID: 1208813202.451963.28514.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 799561 by aacid:

set the label buddy on PolishRequest time instead of creation time because \
d->buddy->associatedWidgets() might still not return a qtoolbar If you run \
ktoolbarlabelactiontest without this patch you'll see that the first \
ktoolbarlabelaction isn't buddied correctly Reading techbase it seems this patch is \
BC, but please tellme if it's not


 M  +15 -10    ktoolbarlabelaction.cpp  
 M  +1 -0      ktoolbarlabelaction.h  


--- trunk/KDE/kdelibs/kdeui/actions/ktoolbarlabelaction.cpp #799560:799561
@@ -87,6 +87,20 @@
   return KAction::event( event );
 }
 
+bool KToolBarLabelAction::eventFilter( QObject *watched, QEvent *event )
+{
+  if ( d->label && d->buddy && event->type() == QEvent::PolishRequest && watched == \
d->label) { +    foreach ( QWidget* widget, d->buddy->associatedWidgets() ) {
+      if ( QToolBar* toolBar = qobject_cast<QToolBar*>( widget ) ) {
+        QWidget* newBuddy = toolBar->widgetForAction( d->buddy );
+        d->label->setBuddy( newBuddy );
+      }
+    }
+  }
+  
+  return KAction::eventFilter( watched, event );
+}
+
 QWidget *KToolBarLabelAction::createWidget( QWidget* _parent )
 {
   QToolBar *parent = qobject_cast<QToolBar *>(_parent);
@@ -104,16 +118,7 @@
                             Qt::AlignVCenter );
     d->label->adjustSize();
     d->label->setText(text());
-
-    if ( d->buddy ) {
-      foreach ( QWidget* widget, d->buddy->associatedWidgets() ) {
-        if ( QToolBar* toolBar = qobject_cast<QToolBar*>( widget ) ) {
-          QWidget* newBuddy = toolBar->widgetForAction( d->buddy );
-          d->label->setBuddy( newBuddy );
-          break;
-        }
-      }
-    }
+    d->label->installEventFilter( this );
   }
 
   return d->label;
--- trunk/KDE/kdelibs/kdeui/actions/ktoolbarlabelaction.h #799560:799561
@@ -102,6 +102,7 @@
 
   protected:
     virtual bool event( QEvent* );
+    virtual bool eventFilter( QObject *watched, QEvent *event );
 
   private:
     class Private;


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

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