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. Using .pro variables in .cpp

Using .pro variables in .cpp

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 800 Views 3 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.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by
    #1

    Hello!

    I want to save a variable in .pro file and then, use it in a class. How can I do it?

    Thank you very much!

    raven-worxR 1 Reply Last reply
    0
    • ivanicyI ivanicy

      Hello!

      I want to save a variable in .pro file and then, use it in a class. How can I do it?

      Thank you very much!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @ivanicy
      easiest way is probably to use DEFINES (preprocessor)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Look here ( to expand on @raven-worx answer)
        https://forum.qt.io/topic/82531/defines-in-qt-creator

        1 Reply Last reply
        0
        • P Offline
          P Offline
          patrik08
          wrote on last edited by
          #4

          Other elegant way is a class name "Config"
          https://github.com/wang-bin/QtAV/blob/568f8c7f365ba2d494956ac59cb6a79ae2485e26/examples/common/Config.h

          Wo write setting direct to ini from OS.. I saw very well this class work on all mobile device & desktop mac window linux ... I was surprised .. waht this smal box can do ...

          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