KActionCollection setAssociatedWidget problems
Thomas Zander
zander at kde.org
Mon Oct 22 11:34:20 BST 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071022/e8230151/attachment.sig>
More information about the kde-core-devel
mailing list