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. Hot to organize the project in diferent folders
Qt 6.11 is out! See what's new in the release blog

Hot to organize the project in diferent folders

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 1.8k Views 2 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.
  • E Offline
    E Offline
    Exotic_Devel
    wrote on last edited by
    #1

    I've done it before but after long years without using Qt, I no longer remember how to do it.
    How do I organize project files in separate folders? I want to create a directory division like MVC patern.
    Qt Creator doesn't do this, it keeps all files in the same directory.
    I remember that this involves some configuration in the .pro file for Qt Creator to display the folders created with their respective files.

    Models
        |___anyfileaboutmodel.cpp
        |___anyfileaboutmodel.hpp
    Views
        |___anyfileaboutview.cpp
        |___anyfileaboutview.hpp
    controls
        |___anyfileaboutcontrol.cpp
        |___anyfileaboutcontrol.hpp
    dal
        |___anyfileaboutdataacces.cpp
        |___anyfileaboutdataacces.hpp
    res
        |___anyresourcefile
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      In that case, just create the folders in your project folder and in your .pro file:

      SOURCES += \
          $$PWD/controls/anyfileaboutcontol.cpp
      

      or alternatively you can add a .pri file per subfolder that you will include in your main .pro file.

      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
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Do you mean you just want to have your classes in different sub folders or are these different sub projects ?

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

        E 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Do you mean you just want to have your classes in different sub folders or are these different sub projects ?

          E Offline
          E Offline
          Exotic_Devel
          wrote on last edited by Exotic_Devel
          #3

          @SGaist said in Hot to organize the project in diferent folders:

          Hi,
          Do you mean you just want to have your classes in different sub folders or are these different sub projects ?

          As in this case it is a single executable, so it is the first option.
          I will need to create sub-projects too but this is another time.
          In addition to classes I also want to place resource files in a folder called res or resources.

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

            In that case, just create the folders in your project folder and in your .pro file:

            SOURCES += \
                $$PWD/controls/anyfileaboutcontol.cpp
            

            or alternatively you can add a .pri file per subfolder that you will include in your main .pro file.

            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
            1

            • Login

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