Important: Please read the Qt Code of Conduct -

Hide *.pri include in Project Tree

  • Each file "include.pri" that i include in my file is listed in the project tree of the Qt Creator.

    Is there a way to hide particular included files in the project tree?

  • Unfortionetaly, i did not receive help in that matter. Let me reform my question(s).

    Question 1.) How do i hide an included PRI file from the QT Creator Project Tree?

    Question 2.) How can i change the name in the project tree of a PRI file include to something else than the filename?

    Question 3.) If a PRI file is included which includes another PRI file, then i would like to have them nested. how can i do this?

  • I don't think you can do either 1 or 2, but I think 3 is standard already?

  • I have found some partial solutions to my own questions. :-)

    1.) I found the function called load and instead of a PRI file i include now $$PWD/xxxx.prf - I know it is not really an include but it does exactly what i needed.

    2.) Yes, i worried that this will not be possible.

    3.) According to your answer, i have tested it but it wont work. Can you give me an example how you make this work?

  • My final solution is the function fromfile() instead of including that file.

  • I know it's an old post, but I have the same problem and I didn't found solution...
    Now, it's possible to hide some pri files into the QtCreator tree view?

  • I think that the solution that Stefan Walter is referring to is to use fromfile() function to get some variables from .pri file.
    It will hide the .pri file but it will evaluate the .pri file as many times as many variables your are assigning.
    Here is an example

    • variables.pri
      BUILD_DIR = ../build
      TESTS_DIR = $${BUILD_DIR}/tests

      DESTDIR = $$fromfile(variables.pri, BUILD_DIR)
      TESTDESTDIR = $$fromfile(variables.pri, TESTS_DIR)

    As a result you will not see variables.pri on QtCreator "Projects" tree
    But qmake will read variables.pri twice.

    Convenience vs performance.

  • Thanks for your reply and for explanations about fromfile() solution.

    I'll see if I can use this solution, it's not sure because I set lot of custom variables in my pri files to create a specific environment (I use these pri like "plugins" for my different projects). In my case, I think, to use this solution mean copy all content of my pri files into my pro file. I'll study your solution.

  • Is there still no elegant solution to this?

    Can not get "load" to work, and another post suggests it might be broken.

Log in to reply