[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: KActions...
From: Sven Radej <sven () lisa ! exp ! univie ! ac ! at>
Date: 2000-03-28 11:33:21
[Download RAW message or body]
On Tue, 28 Mar 2000, Simon Hausmann wrote:
>On Tue, 28 Mar 2000, Sven Radej wrote:
>
>> On Tue, 28 Mar 2000, Simon Hausmann wrote:
>> >On Tue, 28 Mar 2000, Sven Radej wrote:
>> >
>> >> Hi (Kurt)
>> >>
>> >> I have multiple [KToggle | KRadio]actions (setA, setB, setC), and I donīt want
>> >> to connect each action to its own slot - I want to connect them all to one
>> >> common slot which knows which action has been activated, like slotABC(int ID).
>> >>
>> >> Question 1: How? I guess KActionCollection should also have signal
>> >> activated(const char *action_name) or activated (KAction *a).
>> >
>> >use sender() :-)
>> Ummm... shouldnīt there be some other way?
>
>Hmm, we use sender() quite often in konqueror for this purpose ;-) , and I
>admit that I like it (it's sooo handy :-)
>
>(or is it really considered to be a bad hack?)
I donīt know.. it looks like one.
From Qt docs:
> const QObject * QObject::sender () [protected]
>
> Returns a pointer to the object that sent the last signal received by this
> object.
>
> Warning: This function violates the object-oriented principle of modularity,
> However, getting access to the sender might be practical when many signals
> are connected to a single slot. The sender is undefined if the slot is
> called as a normal C++ function.
So it doesnīt look good to me.
Btw I find this macro realy handy:
#define Action(a) actionCollection(a)->action()
So you can write
Action("sign_message")->setChecked(true);
--
Sven Radej radej@kde.org
KDE developer Visit http://www.kde.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic