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

List:       kde-core-devel
Subject:    Re: KActionCollection setAssociatedWidget problems
From:       Thomas Zander <zander () kde ! org>
Date:       2007-10-22 10:34:20
Message-ID: 200710221234.20680.zander () kde ! org
[Download RAW message or body]


On Monday 22 October 2007 10:59:06 David Faure wrote:
> I know that I fixed a bug in konqpopupmenu where a call to
> setAssociatedWidget made all actions be plugged twice into the menu. [and
> this was really not obvious from the code]
>
> Somehow, the automatic setting of the shortcut context would be good to
> have, but the automatic addAction seems very confusing; especially since
> for popup menus you usually add actions yourself, and for the rest we use
> XMLGUI -- or what do I miss here?

I found this bug;
http://trolltech.com/developer/task-tracker/index_html?method=entry&id=141646

which is fixed for Qt4.4 by adding an enum value; 
Qt::WidgetWithChildrenShortcut which seems to me to be the most sane 
default for KActionCollection. (and is most like what we were used to in Qt3)

So, what about this patch;
Index: kdeui/actions/kactioncollection.h
===================================================================
--- kdeui/actions/kactioncollection.h   (revision 728031)
+++ kdeui/actions/kactioncollection.h   (working copy)
@@ -29,6 +29,7 @@
 #include <kdeui_export.h>
 #include <kstandardaction.h>
 #include <kcomponentdata.h>
+#include <kdeversion.h>

 #include <QtCore/QObject>

Index: kdeui/actions/kactioncollection.cpp
===================================================================
--- kdeui/actions/kactioncollection.cpp (revision 728031)
+++ kdeui/actions/kactioncollection.cpp (working copy)
@@ -313,7 +313,11 @@
   connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(_k_widgetDestroyed(QObject*)));

   foreach (QAction* action, actions()) {
-    action->setShortcutContext(Qt::WidgetShortcut);
+#if QT_VERSION < KDE_MAKE_VERSION(4,4,0)
+    action->setShortcutContext(Qt::WidgetShortcut); // remove after Qt4.4 becomes mandatory
+#else
+    action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+#endif
     widget->addAction(action);
   }
 }

-- 
Thomas Zander

["signature.asc" (application/pgp-signature)]

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

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