You can combine these into

    #if defined(Q_OS_MAC) && QT_VERSION < 0x050000