Important: Please read the Qt Code of Conduct -

Project Management : Taking a directory location

  • In IntelliJ we have Edit Configuration inside the Run where we can add key value pairs, which can be used in projects. Mostly used to specify a certain directory folder.

    So in Qt is there any way that we can specify something like this in the Qt IDE (build setting or something) and then access it through our code?

  • Lifetime Qt Champion

    Its a bit unclear what you want.

    But yes, you can add to the .pro file and read in the app.

    like i do

    so i know where the project folder is and read the gfx from there so i dont have to
    copy all to build folder.

    then in .cpp i do
    const char* ProducerLocation = STR(PROJECT_LOCATION);

    so yes u can make defines and use.

  • @mrjj said in Project Management : Taking a directory location:


    Hi, Thanks for the answer.

    What I basically want is there is a folder (let's call dummyFolder) used in the project to save the output files, that is there in everyone's system.
    But the dummyFolder location is different for different people but we need this dummyFolder path in the project.

    So if there is a way where anyone can modify it in some setting of the project instead of changing the path in the code.

  • Why not reading the command line of the app,
    of if not possible read the Environment-Variables of the system
    to find the location of dummyFolder ?


  • Lifetime Qt Champion


    From your example it sounds like you should rather use QStandardPaths.

  • Hi is this the dummy folder?

    MOC_DIR = build
    RCC_DIR = build
    OBJECTS_DIR = build

    for me is this the a dir resrved to compiler.. :-)
    the most important to me is the bash_profie. file..
    like so..

Log in to reply