[PATCH] class KAction : public QAction
Hamish Rodda
rodda at kde.org
Sun Nov 20 05:49:48 GMT 2005
Hi,
Here's my first compiling + partially working patch which refactors KAction to
be a subclass of QAction. See the thread "The future of KAction" for the
reasons why I've done this. Also of note in this patch are that KToolBar is
ported to QToolBar, and KMainWindow ported to QMainWindow.
The patch is not intended for committing in its current state - there are many
issues which need to be worked out.
Note that this does not look at the other proposal of replacing the XML part
of KXMLGUI.
You can find the (large) patch (against kdelibs head) at:
http://members.optusnet.com.au/~hamishrodda/kaction.patch.bz2
The current issues I'm facing, mostly by class:
* Should a branch of kdelibs be created with this patch for those who would
like to help? (is there anyone interested in helping with the hacking ;)
* who is the best person to ask at Trolltech about the issues below? (should I
just send the list to qt-bugs?)
Issues for Trolltech (my "Trolltech shopping list" :)
QAction
Needed (no workaround available without large hacks):
* add reason for activation (ToolBar, MenuBar, Menu, Emulated etc)
* need a way to determine which widget(s) the action is plugged into
* const QList<QWidget*> QAction::addedWidgets() const; (protected is ok)
* needed for: unplugging without deleting, compatibility with previously
provided KAction methods
Would be nice to have (can be worked around):
* new triggered signal with keyboard and mouse modifiers
* signal enabled(bool enabled)
* reasonable enough I think :)
* protected method setChanged() which calls QActionPrivate::sendDataChanged()
* needed as KAction adds more properties which would warrant a
ActionChanged signals being sent
* could be worked around if we have the addedWidgets() call
QMenuBar
* addSepararator() missing insertSeparator() pair as per usual api
QToolBar / QToolButton
* need to be able to get the widget(s) implementing each action
* const QList<QWidget*> widgetsForAction(QAction*) const;
QMainWindow
* KMainWindow used to save the state of the toolbars itself; this information
is not fully available now. The trouble with using saveState() is that we
need to be able to save part of the state, e.g. just the toolbars, dock
widgets etc. belonging to one KPart. I can't see KDE using saveState() as it
is now.
* need to be able to get a list of toolbars actually added (vs. just children
of the mainwindow)
* ditto for dock widgets
* need to be able to get a list of toolbar breaks
* a side effect of not being able to find out which toolbars are added: you
can't find out the area of a toolbar without assert, if you don't know if
it's inserted or not
QMenu
* QMenu constructor allowing for the menuAction() to be supplied (so it can be
a KMenu)
General (more looking at the future of KAccel)
* Is conversion between X11 and qt key codes available?
* Does Qt support all x11 keycodes? Are any new codes supported with each
release (ie does KDE really need to be worrying about platform-native key
codes)
Issues for KDE:
Removed Classes (not required)
* KToolBarButton - all done by QToolButton now
* KToolBarRadioGroup - all done by QToolButton now
KAction Port
* Inherits from QAction
* Exclusivity between several options now handled by QActionGroup
* KShortcuts supported by shortcut/setShortcut (hides QAction's
shortcut/setShortcut)
* KDE Icon name supported by setIconName which in turn loads the requested
icon
* Constructors refactored to match Qt more closely (does this look right?)
Issues
* Plugged Container list not available (isPlugged(), unplugAll(), container())
[Qt dependency]
* KAccel usage - hopefully KAccel not needed anymore (just have to sort out
issue with KActionCollection
* need to check use of indexes to insert actions (add compatibility function?)
KAction Subclasses
KToggleAction
* setExclusiveGroup removed -use a QActionGroup instead
KRadioAction
* Removed, use QAction::setCheckable() and QAction::setActionGroup() instead
* bring back for compatability or convenience? (but exists already as
KToggleAction)
KSelectAction
* Enhanced with QAction based api
* compatibility index based api (mark as deprecated? KDE3_SUPPORT?)
* For now, can create popup menus or a combo box; popup menu can be delayed,
etc.
KListAction
* Removed - as per comments, does not add anything to KSelectAction
KRecentFilesAction, KFont*Action, KToggleFullScreenAction, KPasteTextAction
* Ported
KActionMenu, KToolBarPopupAction
* now performed by KSelectAction
* remove?
KWidgetAction Todo:
* needs several standard features:
* resize widget
* clear widget
KActionCollection
* accel stuff removed (see below)
* removed setWidget() - to be replaced? (depends on if KAccel is still needed
or not)
* autoConnectShortcuts removed - irrelevant
* lots of de-virtualisation of methods
* highlightingEnabled - removed, now on by default (as per / to be controlled
by style)
* widgetCount() removed - reinstate when KAction knows the bound widgets? (is
it even needed?)
KAccel
* Really need to figure out whether it's needed or not.
* does qt support plugging actions as shortcuts into any widget?
* will qt support multiple shortcuts?
* read old documentation in KAction
KXMLGUI*
* begin/end xml plug needed?
KToolBar Port
* most methods removed - not needed in the new way of doing things
* can't get the widget corresponding to an action [Qt dependency]
* flat mode cannot be implemented
* is it even needed?
* floating mode cannot be implemented directly
* workaround - create a new class KToolDock and transfer actions over when
we want to float it
* transparent moves not relevant with KToolBar (or a style issue anyway)
* saving and restoring of state not fully possible with current Qt api [Qt
dependency]
KToolBar Todo:
* custom widgets not yet used
* multiple shortcuts not implemented
* crash when trying to add toolbar to non-qmainwindow
* Context menu only available over areas which don't have an action
KMainWindow port
* save/load support incomplete [Qt dependency]
KToolBarLabelAction Todo:
* buddy using QAction instead of QWidget
KDE 3 Support
KToolBar
* KDE 3 support insert* methods needed
KMDI
* Removed from compile - significant effort would be required to port it to
QMainWindow.
General TODO
* virtual function review
Cheers,
Hamish.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051120/d566f2c5/attachment.sig>
More information about the kde-core-devel
mailing list