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

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/widgets
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2010-06-07 13:15:40
Message-ID: 20100607131540.75C76AC8D0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1135509 by aacid:

another micro optimization, avoid the detach on the list when calling first making \
sure we call on a const list Suggested by ossi


 M  +5 -2      ktoolbar.cpp  


--- trunk/KDE/kdelibs/kdeui/widgets/ktoolbar.cpp #1135508:1135509
@@ -1187,13 +1187,15 @@
     }
 
     QToolButton* tb;
-    if ((tb = qobject_cast<QToolButton*>(watched)) && !tb->actions().isEmpty()) {
+    if ((tb = qobject_cast<QToolButton*>(watched))) {
+        const QList<QAction*> tbActions = tb->actions();
+        if (!tbActions.isEmpty()) {
         // Handle MMB on toolbar buttons
         if (event->type() == QEvent::MouseButtonPress || event->type() == \
QEvent::MouseButtonRelease) {  QMouseEvent* me = static_cast<QMouseEvent*>(event);
             if (me->button() == Qt::MidButton /*&&
                                                  \
                act->receivers(SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)))*/) \
                {
-                QAction* act = tb->actions().first();
+                    QAction* act = tbActions.first();
                 if (me->type() == QEvent::MouseButtonPress)
                     tb->setDown(act->isEnabled());
                 else {
@@ -1222,6 +1224,7 @@
             }
         }
     }
+    }
 
     // Redirect mouse events to the toolbar when drag + drop editing is enabled
     if (toolBarsEditable()) {


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

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