[PATCH] KToggleToolbarAction, KWidgetAction
Simon Hausmann
hausmann at kde.org
Mon Apr 8 15:28:21 BST 2002
On Mon, Apr 08, 2002 at 03:05:08PM +0200, David Faure wrote:
> On Monday 08 April 2002 04:45, John Firebaugh wrote:
> > The attached patch adds two new KAction-subclasses: KToggleToolbarAction and
> > KWidgetAction. The first handles everything associated with a "Show ___
> > Toolbar" menu item, including updating itself when the toolbar is shown or
> > hidden programmatically. Use of this class will make bugs like "Bug#40413:
> > Selections in Settings are displayed incorrectly" easy to fix. The second
> > provides an easy way to insert custom widgets into toolbars. It removes the
> > necessity of subclassing KAction for every widget you want to insert into a
> > toolbar.
> >
> > To support KToggleToolbarAction I had to make a small change to
> > kxmlguibuilder: it now queries the main window for the specified toolbar and
> > creates a new one only if the query returns null.
> >
> > Under the hood, use of KToggleToolbarAction changes one thing that may or may
> > not be of significance: a toolbar with an associated KToggleToolbarAction
> > will always be created, at the time the action is plugged, regardless of
> > whether the toolbar is ever used.
> >
> > Comments, suggestions, objections? If none of the latter, I will commit in 2
> > days.
>
> KWidgetAction is great. I think it removes the need for Richard Moore's
> KSliderAction, KDialAction etc. This single action can take care of
> all those custom widgets.
>
> For KToolbarAction, I'd like Simon to comment on the builder change ;)
Looks all good to me ;) I like the idea of
widgetaction/toolbartoggleaction. Just one tiny comment on the
toolbar toggle action: I'd store the toolbar name in a QCString.
Although in most cases people are going to use it like
new KToolBarToggleAction( "footoolbar" , ... )
I think still it's dangerous, because as soon as you don't do it
that way you require the caller to think about the memory management
of this stupid argument you pass. I'd rather be defensive here, and
it's not that a huge loss is involved here when using QCString.
Another tiny thing I just noticed: Please name it
KToolBarToggleAction, with a capital B. That's consistent to
KToolBar and QToolBar :)
Simon
More information about the kde-core-devel
mailing list