Qt Creator - no highlighting for ifdef blocks


  • Moderators

    I'm currently working on an application, that due to it's nature requires quite a lot of ifdefs in the code. I'm developing on Kubuntu, with Qt Creator using Kate's syntax highlighting.

    The problem is that inside ifdef blocks the code is grayed-out. I understand that this might be a good feature for some people that want to omit parts of the code that are not currently defined, but I would like to have highlighting everywhere. Is it possible to change this behaviour? I have looked through QtC's options, but found none. As a temporal hack, I simply comment the ifdefs out during my coding, but it's not very elegant or useful.



  • I don't know how to make QT do it like you want to, but you can do this:

    • Only use #ifdef (not #else)
    • Create a new build configuration where you define al those.
    • Switch when you build to your normal configuration.

  • Moderators

    Doesn't seem to be working. But it looks like a nice idea :)



  • using DEFINES+=... in your QMake additional arguments line?


  • Moderators

    ah, bingo, that did it! Thanks a lot!


Log in to reply
 

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