Determine which modules were loaded in the .pro file, using preprocessor #ifdef



  • Hi,

    I'm trying to determine which QT modules are loaded in the .pro file, e.g.:
    QT += svg printsupport
    and either include or exclude own code sections with preprocessor macros, depending on that.
    Do they define some convenient flags that could be tested with #ifdef? I only know of QT_NO_PRINTER, which roughly corresponds to what I'm looking for, for the printsupport module. But is there a general way that works also for other modules, e.g. svg?


  • Lifetime Qt Champion

    Hi,

    QT_NO_PRINTER is (or not) defined when compiling Qt, not when loading or not a module.
    One thing you could is the qtHaveModule() function in your pro file and create the defines you need there.

    Hope it helps


Log in to reply
 

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