RFC: An action class to ease implementation of show/hide-like actions
Ingo Klöcker
kloecker at kde.org
Sun Sep 19 15:47:06 BST 2010
On Sunday 19 September 2010, Aurélien Gâteau wrote:
> On 18/09/2010 12:33, Ingo Klöcker wrote:
> > On Saturday 18 September 2010, Aurélien Gâteau wrote:
> >> On 18/09/2010 00:06, Ingo Klöcker wrote:
> >>> On Friday 17 September 2010, Aurélien Gâteau wrote:
> >> I created this constructor to make it as easy as possible to
> >> replace a KToggleAction with a KDualAction. Since KToggleAction
> >> has a constructor which takes the offActionText, I created one as
> >> well. Maybe it should be changed to KDualAction(offText, onText,
> >> parent). What do you think of this?
> >
> > Makes more sense since a dual action will probably always have two
> > different texts. (Otherwise, one wouldn't use it.)
>
> Indeed.
>
> > I'd revert the two texts, but that's probably just me.
>
> What do you mean?
I meant change their order, i.e.
KDualAction( activeText, inactiveText, parent )
> >>>> bool isActive() const;
> >>>> void setActive(bool);
> >>>> void silentSetActive(bool);
[snip]
> >>> IMHO something like a silentSetActive() (or using blockSignals())
> >>> is evil because the caller can never know whether there are other
> >>> listeners which rely on the signal to be emitted. Therefore, I
> >>> strongly suggest removing this method from the class's interface.
> >>
> >> I think it is useful to have this method for situations where the
> >> state of the element represented by the action has changed and you
> >> need to update the action to reflect the new state.
[snip]
>
> Would you prefer Matthew solution (two different signals?)
I'm not sure whether it's worth adding two different signals. But I'd
prefer Matthew's solution over a silentSetActive() method because it
let's the listener decide whether he is interested in changes triggered
by the user only or in all changes.
Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100919/000e8355/attachment.sig>
More information about the kde-core-devel
mailing list