If a file uses Q_INTERFACES(x), then moc simply pulls out the 'x' directly, without doing any real preprocessing.  So, you can't do:

#if QT5
    Q_INTERFACES(Qt5Class)
#else
    Q_INTERFACES(Qt4Class)
#endif

The above will yield 'unknown interface Qt5Class' in qt4.  I couldn't find any way to work around it, but if you can, we don't need the duplication.