Macros for simplifying transferring code from another framework

  • Hello!

    I'm porting my C++ Windows-project built with Embarcadero RAD Studio to Linux with Qt. So I have many statements in my code like that:

    @Menu->Enabled = true;@

    For Qt it should be transformed like that:


    So now I'm losing a lot of time commenting code. Is there a way to do this replacement automatically (maybe by writinf some macros using #define or something using Qt)?

  • Moderators

    Macros like that would be a nightmare to maintain. I would go for a careful text replacement. "Enabled = true" -> "setEnabled(true)" shouldn't be that difficult. And of course test the bejesus out of it afterwards (you do have unit tests right?).

  • Unit tests are not used in the project, but I suggest it's very useful.

  • Lifetime Qt Champion


    When porting an application like that it can become vital to ensure you didn't broke anything.

Log in to reply

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