[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Calling arbitrary slots
From:       Lubos Lunak <l.lunak () sh ! cvut ! cz>
Date:       2001-05-18 13:54:40
[Download RAW message or body]

Dne pá 18. květen 2001 15:25 Martijn Klingens napsal(a):
> Hi,
>
> I want to maintain a list with RegExps and the associated event handler
> that should be executed when the input mathces the expression. Looking in
> the Qt sources I discovered that slots are actually just a const char *, so
> I created the following class:
>
> class InputFilter
> {
> public:
>   InputFilter( const QString &pattern, QObject * receiver,
>                 const char * member );
>   void exec( QString line );
> };
>
> The idea was to run the event handler from exec() in the way e.g.
> QTimer::singleShot does. But that doesn't work because the QSignal that is
> used there doesn't take arguments.
>
> What I want to call is
>
> receiver->member( line );
>
> where member is the name of the member as a usual slot and line is a
> QString. Maybe I need more parameters later on, BTW, but for now the
> QString suffices.
>
> How can I do this (or what part of Qt does the same thing, so I can look
> there) ? The classes that I tried only emitted their own signals, but I
> couldn't find a place where a signal handler is explicitely called.
>
> The only solution I can think of is emitting a signal from exec that can be
> connected upon object creation time, but that adds an extra line of code to
> each object (the connect) and probably a bit more overhead.
>
> Is there a better solution than that?

 If I understand what you want to do, have a look at KGlobalAccel , the 
activated() signal ( and KGlobalAccel::x11EventFilter() ).

>
> TIA,
>
> Martijn

 Lubos Lunak
--
 l.lunak@email.cz ; l.lunak@kde.org
 http://dforce.sh.cvut.cz/~seli

>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic