On Tue, Jun 07, 2011 at 01:29:27PM +0200, Enrico Forestieri wrote:
> On Tue, Jun 07, 2011 at 11:52:02AM +0200, Jean-Marc Lasgouttes wrote:
> > Le 07/06/2011 09:01, Enrico Forestieri a écrit :
> > >The moc doesn't have a definition of QT_VERSION, so the check
> > >"#if QT_VERSION>= 0x040600" fails and you always get the "#else"
> > >clause.
> > 
> > Here is my next try. Something similar will have to be done for
> > cmake and scons.
> 
> I think this is not going to work. From what I see looking at qt4.m4,
> QT4_VERSION contains the string version, i.e., 4.7.3 and not 0x040703.
> So, either we extract the definition of QT_VERSION (rather than
> QT_VERSION_STR) from qglobal.h or manipulate QT4_VERSION in order
> to produce the right format.

The attached patch (revised from yours) works for me.

-- 
Enrico
Index: src/frontends/qt4/Makefile.am
===================================================================
--- src/frontends/qt4/Makefile.am       (revisione 38970)
+++ src/frontends/qt4/Makefile.am       (copia locale)
@@ -16,9 +16,11 @@ ui_%.h: ui/%.ui
 
 MOCEDFILES = $(MOCHEADER:%.h=moc_%.cpp)
 
+QT_VERSION = $(shell IFS=.; set -- `echo $(QT4_VERSION)`; echo 0x0$$10$$20$$3)
+
 # The moc_%.cpp pattern must match the filter in ../../../po/Rules-lyx
 moc_%.cpp: %.h
-       $(AM_V_GEN)$(MOC4) -o $@ $<
+       $(AM_V_GEN)$(MOC4) -DQT_VERSION=$(QT_VERSION) -o $@ $<
 
 Resources.qrc: Makefile
        $(AM_V_GEN)echo "<!DOCTYPE RCC><RCC version='1.0'><qresource>" > $@ ; \
Index: src/frontends/qt4/FancyLineEdit.h
===================================================================
--- src/frontends/qt4/FancyLineEdit.h   (revisione 38970)
+++ src/frontends/qt4/FancyLineEdit.h   (copia locale)
@@ -22,6 +22,7 @@ namespace frontend {
 
 class FancyLineEditPrivate;
 
+#if QT_VERSION >= 0x040600
 class IconButton: public QAbstractButton
 {
        Q_OBJECT
@@ -44,7 +45,7 @@ private:
     bool m_autoHide;
     QPixmap m_pixmap;
 };
-
+#endif
 
 /* A line edit with an embedded pixmap on one side that is connected to
  * a menu. Additionally, it can display a grayed hintText (like "Type Here to")

Reply via email to