Qt 4.8 QT_VERSION_CHECK and moc [WORKAROUND]



  • Hi all, sorry if this might have been already asked. I searched the forums but got nowhere.
    I'm now adding new features to my software using Qt 5.2.1.
    I've added several checks in the code like this:

    @
    #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    void slotVideoChecked(bool state);
    #endif
    @

    However, when moc creates the moc_*.cpp files, it seems to ignore the #if check, thus giving me build errors on Qt4.

    Any clue/workaround ?
    Thanks in advance



  • OK, found what it is, as stated here:
    http://qt-project.org/forums/viewthread/31641

    On signals and slots in my header files, I need to change the check from
    @#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)@
    to
    @#if QT_VERSION >= 0x050000@

    It's a dirty workaround and it seems like a never fixed thing in Qt 4 (I'm on 4.8.4)



  • I've been stuck on the same issue from last two days now, and just came across your workaround...thank you so much for posting this.

    [quote author="mcallegari79" date="1392554855"]OK, found what it is, as stated here:
    http://qt-project.org/forums/viewthread/31641

    On signals and slots in my header files, I need to change the check from
    @#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)@
    to
    @#if QT_VERSION >= 0x050000@

    It's a dirty workaround and it seems like a never fixed thing in Qt 4 (I'm on 4.8.4)[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.