[cfe-dev] Proposal: parsing Qt signals/slots with attributes
Konstantin Tokarev
annulen at yandex.ru
Mon Sep 26 02:54:09 PDT 2011
26.09.2011, 12:58, "Miles Bader" <miles at gnu.org>:
> Konstantin Tokarev <annulen at yandex.ru>
> writes:
>
>> Qt is not "a specific GUI library". It's framework for C++ development which
>> could be used to develop large range of applications including GUI and
>> non-GUI ones.
>
> Er, .... let's be practical though: these language extensions are _in
> practice_ only used by this particular GUI framework/library/
> call-it-what-you-will.
>
>>> Wouldn't some sort of generic mechanism be more desirable?
>> OK, could you recommend better way to mark methods in "signals" and
>> "slots" sections with specific attributes without significant
>> performance loss?
>
> Since your basic goal seems to simply adding new attributes, which are
> then stored in the AST, and can be tested for, why not instead a
> implement a feature that allows new attributes to be added at runtime?
This feature would be very nice, however, it doesn't solve whole problem.
Here's declaration of generic Qt class
class QtClass : public QObject
{
Q_OBJECT // This is a macro used for code generation and inserting
// some common code; slots and signal won't work without it
public:
QtClass();
// some other stuff
public slots: // slots is a macro expanding to whatever we want
slotA();
slotB();
private slots:
slotC();
slotD();
signals: // signals is a macro expanding to whatever we want
signal1();
signal2();
signal3();
// some other stuff
};
It's needed to assign specific attributes to all slots and signals.
--
Regards,
Konstantin
More information about the cfe-dev
mailing list