[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: MOC Generation and #preprocessor fields
From: Michael Buesch <mbuesch () freenet ! de>
Date: 2005-06-20 7:39:29
Message-ID: 200506200939.30130.mbuesch () freenet ! de
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Quoting Nicolas Ternisien <nicolas.ternisien@gmail.com>:
> Hello everybody!!!
>
> Due to compatibility issue, I have to add this kind of code to my header file :
>
> public slots:
>
> #if KDE_VERSION ...
> #...
> #define PARAMETER_LOG_ACTION Qt::ReleavantAction, Qt::ButtonState
> (something like that)
> #else
> #define PARAMETER_LOG_ACTION void
>
> void slotLogActions(PARAMETER_LOG_ACTION);
>
> Of course, it's a slot to connect with KAction::activated() signal,
> which in KDE 3.4 has 2 declaration : a method without parameter, and
> another one with 2 parameters (defined by PARAMETER_LOG_ACTION
> constants
>
> My problem is that when the MOC file is compiled, it of course does
> not see preprocessing commands, and add a strange slot
>
> slotLogActions(PARAMETER_LOG_ACTION);
>
> So my question is : How to avoid this problem ?
>
> Is there any way to hide a slot, and manually add them, depending of
> the KDE version, or something like that ?
>
> My only issue is to create 2 static (!= dynamic, not recompiled each
> time my header changed) moc files, and include them depending of the
> version, but this is absolutely not practical, as I must recompiled
> them when my header file change.
You say that the slots have a different parameter signature, so
it shouldn't be a problem to declare both of them at once.
Use #ifdef in the code implementation:
...::slotLogActions()
{
#ifdef VER1
#endif
}
...::slotLogActions(...)
{
#ifdef VER2
#endif
}
This way one of the two slots is always only a dummy.
--
Greetings, Michael
[Attachment #5 (application/pgp-signature)]
>> Visit http://mail.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