Re: #if in header files

2007-06-13 Thread Edwin Leuven
Peter Kümmel wrote: but have you tried #if (QT_VERSION >= 0x040200) ? doesn't work

Re: #if in header files

2007-06-12 Thread Peter Kümmel
Andre Poenitz wrote: > On Tue, Jun 12, 2007 at 09:38:59PM +0200, Peter Kümmel wrote: >> Edwin Leuven wrote: >>> Edwin Leuven wrote: Peter Kümmel wrote: > I'm wrong, moc is better now. Here (4.3) this macro check works: > > #if (QT_VERSION >= QT_VERSION_CHECK(4, 2, 0)) >>> and >>> >

Re: #if in header files

2007-06-12 Thread Andre Poenitz
On Tue, Jun 12, 2007 at 09:38:59PM +0200, Peter Kümmel wrote: > Edwin Leuven wrote: > > Edwin Leuven wrote: > >> Peter Kümmel wrote: > >>> I'm wrong, moc is better now. Here (4.3) this macro check works: > >>> > >>> #if (QT_VERSION >= QT_VERSION_CHECK(4, 2, 0)) > > > > and > > > > #if QT_VERSION

Re: #if in header files

2007-06-12 Thread Edwin Leuven
Peter Kümmel wrote: maybe QT_VERSION_CHECK is new in qt4.3, could you find it in src/corelib/global/qglobal.h? you're right, it's not there (4.2.1) Does it help when you add for Qt<4.3? #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) when i add this to the he

Re: #if in header files

2007-06-12 Thread Peter Kümmel
Edwin Leuven wrote: > Edwin Leuven wrote: >> Peter Kümmel wrote: >>> I'm wrong, moc is better now. Here (4.3) this macro check works: >>> >>> #if (QT_VERSION >= QT_VERSION_CHECK(4, 2, 0)) > > and > > #if QT_VERSION >= QT_VERSION_CHECK(4, 2, 0) > > compiles but with the following messages: > > 1

Re: #if in header files

2007-06-12 Thread Edwin Leuven
Edwin Leuven wrote: Peter Kümmel wrote: I'm wrong, moc is better now. Here (4.3) this macro check works: #if (QT_VERSION >= QT_VERSION_CHECK(4, 2, 0)) and #if QT_VERSION >= QT_VERSION_CHECK(4, 2, 0) compiles but with the following messages: 1>c:\lyx\trunk\src\frontends\qt4\IconPalette.h(20

Re: #if in header files

2007-06-12 Thread Edwin Leuven
Peter Kümmel wrote: Peter Kümmel wrote: http://lists.trolltech.com/qt-interest/2006-05/thread00319-0.html http://lists.trolltech.com/qt-interest/2000-10/msg00401.html A solution would be to have two header files, and to include the header and moc file in a #if block. I'm wrong, moc is better

Re: #if in header files

2007-06-12 Thread Peter Kümmel
Peter Kümmel wrote: > > http://lists.trolltech.com/qt-interest/2006-05/thread00319-0.html > http://lists.trolltech.com/qt-interest/2000-10/msg00401.html > > A solution would be to have two header files, and to include the header > and moc file in a #if block. I'm wrong, moc is better now. Here

Re: #if in header files

2007-06-12 Thread Andre Poenitz
On Tue, Jun 12, 2007 at 02:16:48PM +0200, Pavel Sanda wrote: > > perhaps someone can tell me the way to do this? > > > # if QT_VERSION >= 0x040200 > > i'm just guessing but is correct the space between '#' and 'if' ? That's no problem. On the contrary, '#' must be in the first column, even if m

Re: #if in header files

2007-06-12 Thread Peter Kümmel
Leuven, E. wrote: > i would like to have another implementation for IconPalette for qt version > 4.2 and higher, and am wondering how to do this. > > now i have the code below in the header file but the compiler doesn't seem to > like it. > > perhaps someone can tell me the way to do this? > >

RE: Re: #if in header files

2007-06-12 Thread Juergen Spitzmueller
Leuven, E. wrote: > but isn't the problem here that the #if's don't get respected? Does it help if you add the condition inside the function, when a function is defined twice for either version? I.e., only define each function once, but define different content? Jürgen

RE: Re: #if in header files

2007-06-12 Thread Leuven, E.
>> but isn't the problem here that the #if's don't get respected? >> >> (and we would end up trying to compile a class that inherits qwidgetaction >> with qt 4.1) > > Maybe not, look at the generated moc file in order to make sure. it has the following (and it shouldn't be there) // SIGNAL 1 vo

Re: #if in header files

2007-06-12 Thread Abdelrazak Younes
Leuven, E. wrote: Abdelrazak Younes wrote: Leuven, E. wrote: I guess moc doesn't care about the #if. You should probably use different naming for the two classes. but in qt 4.1 there is no qwidgetaction so will still need some magic no? Sure, the #if should stay but for 4.2 you should maybe re

RE: Re: #if in header files

2007-06-12 Thread Leuven, E.
Abdelrazak Younes wrote: > Leuven, E. wrote: >>> I guess moc doesn't care about the #if. You should probably use >>> different naming for the two classes. >> >> but in qt 4.1 there is no qwidgetaction so will still need some magic no? > > Sure, the #if should stay but for 4.2 you should maybe ren

Re: #if in header files

2007-06-12 Thread Abdelrazak Younes
Leuven, E. wrote: I guess moc doesn't care about the #if. You should probably use different naming for the two classes. but in qt 4.1 there is no qwidgetaction so will still need some magic no? Sure, the #if should stay but for 4.2 you should maybe rename IconPalette to IconPalette42. Just

RE: Re: #if in header files

2007-06-12 Thread Leuven, E.
>I guess moc doesn't care about the #if. You should probably use > different naming for the two classes. but in qt 4.1 there is no qwidgetaction so will still need some magic no?

RE: #if in header files

2007-06-12 Thread Leuven, E.
Pavel wrote: >> # if QT_VERSION >= 0x040200 > > i'm just guessing but is correct the space between '#' and 'if' ? doesn't matter i copy-pasted these things, but in the end i tried both perhaps cmake doesn't preprocess the header files properly, i am at a loss here...

Re: #if in header files

2007-06-12 Thread Abdelrazak Younes
Leuven, E. wrote: Jean-Marc Lasgouttes wrote: > This is supposed to work. What error message do you get? patch attached. this allows tearing-off of the math panels with qt>= 4.2 (bugs 3839 and 3840) I guess moc doesn't care about the #if. You should probably use different naming for the two

Re: #if in header files

2007-06-12 Thread Pavel Sanda
> perhaps someone can tell me the way to do this? > # if QT_VERSION >= 0x040200 i'm just guessing but is correct the space between '#' and 'if' ? pavel

RE: #if in header files

2007-06-12 Thread Leuven, E.
Jean-Marc Lasgouttes wrote: > This is supposed to work. What error message do you get? patch attached. this allows tearing-off of the math panels with qt>= 4.2 (bugs 3839 and 3840) here the error: 1>C:\lyx\build-msvc\src\frontends\qt4\IconPalette_moc.cpp(61) : error C2352: 'QWidget::qt_metacas

Re: #if in header files

2007-06-12 Thread Jean-Marc Lasgouttes
> "Edwin" == Leuven, E <[EMAIL PROTECTED]> writes: Edwin> # if QT_VERSION >= 0x040200 Edwin> class IconPalette : public QWidgetAction { ... }; Edwin> # else Edwin> class IconPalette : public QWidget { ... }; Edwin> # endif // QT_VERSION >= 0x040200 This is supposed to work. What error mes

#if in header files

2007-06-12 Thread Leuven, E.
i would like to have another implementation for IconPalette for qt version 4.2 and higher, and am wondering how to do this. now i have the code below in the header file but the compiler doesn't seem to like it. perhaps someone can tell me the way to do this? thanks! # if QT_VERSION >= 0x0402