Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Macro in Ui file
Forum Updated to NodeBB v4.3 + New Features

Macro in Ui file

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 3 Posters 368 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.
  • J Offline
    J Offline
    Jk25
    wrote on last edited by
    #1

    I had defined a Macro in cmakeList.txt (e.g., MY_PROJECT = Abc), I want to use that macro in form file's object name (MY_PROJECT::MyTest). it is not taking value of macro, instead it creates ui_MyTest.h with that Macro itself.
    namespace MY_PROJECT{
    namespace Ui{
    }
    }

    I want to know, why it is not replacing MY_PROJECT with Abc. Is there any other way to achieve this.

    Christian EhrlicherC 1 Reply Last reply
    0
    • J Jk25

      I had defined a Macro in cmakeList.txt (e.g., MY_PROJECT = Abc), I want to use that macro in form file's object name (MY_PROJECT::MyTest). it is not taking value of macro, instead it creates ui_MyTest.h with that Macro itself.
      namespace MY_PROJECT{
      namespace Ui{
      }
      }

      I want to know, why it is not replacing MY_PROJECT with Abc. Is there any other way to achieve this.

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Jk25 said in Macro in Ui file:

      I want to know, why it is not replacing MY_PROJECT with Abc. Is there any other way to achieve this.

      Because uic does not handle any macros. It is not designed for such hacks.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      J 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        @Jk25 said in Macro in Ui file:

        I want to know, why it is not replacing MY_PROJECT with Abc. Is there any other way to achieve this.

        Because uic does not handle any macros. It is not designed for such hacks.

        J Offline
        J Offline
        Jk25
        wrote on last edited by
        #3

        @Christian-Ehrlicher Thanks for the info.
        Is there any other way to achieve this. As, I'm trying to change at once place and whole project get those changes.

        jsulmJ 1 Reply Last reply
        0
        • J Jk25

          @Christian-Ehrlicher Thanks for the info.
          Is there any other way to achieve this. As, I'm trying to change at once place and whole project get those changes.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Jk25 said in Macro in Ui file:

          I'm trying to change at once place and whole project get those changes.

          Why is this needed?
          One way would be to have a custom build step where you use *.ui template files to replace whatever you want to replace. But then you will also need to do it in source code where you use the generated header files. I really don't get the point to do such things.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

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