Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Macros for simplifying transferring code from another framework

Macros for simplifying transferring code from another framework

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alan73
    wrote on last edited by
    #1

    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:

    @Menu->setEnabled(true);@

    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)?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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?).

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alan73
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved