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. Creating new project from existing files
Forum Updated to NodeBB v4.3 + New Features

Creating new project from existing files

Scheduled Pinned Locked Moved Qt Creator and other tools
26 Posts 4 Posters 33.2k 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.
  • G Offline
    G Offline
    goetz
    wrote on last edited by
    #21

    Ahm... in my version (and every version I know of since Qt 3.0 times) mention the -project switch:

    @
    macbookpro ~ $ qmake
    Usage: qmake [mode] [options] [files]

    QMake has two modes, one mode for generating project files based on
    some heuristics, and the other for generating makefiles. Normally you
    shouldn't need to specify a mode, as makefile generation is the default
    mode for qmake, but you may use this to test qmake on an existing project

    Mode:
    -project Put qmake into project file generation mode
    In this mode qmake interprets files as files to
    be built,
    defaults to *.c; *.ui; *.y; *.l; *.ts; *.xlf; *.qrc; *.h; *.hpp; *.hh; *.hxx; *.H; *.cpp; *.cc; *.cxx; *.C
    Note: The created .pro file probably will
    need to be edited. For example add the QT variable to
    specify what modules are required.
    -makefile Put qmake into makefile generation mode (default)
    In this mode qmake interprets files as project files to
    be processed, if skipped qmake will try to find a project
    file in your current working directory
    @

    And of course there's always the famous

    @
    qmake -help
    @

    :-)

    http://www.catb.org/~esr/faqs/smart-questions.html

    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #22

      Oh, <insert curse word here>...

      ...burned by my lousy terminal scrolling ability. (Zimmers' 2nd rule of programming; blame as much as possible on the tools for your own foolishness.)

      Thanks for the correction, Volker...now, if I can just get my build working (but I've started a new thread for that).

      1 Reply Last reply
      0
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #23

        So...let me ask a related question, and this is more of style/convention than Qt usage.

        If you have a relatively large project (say 100 source files), is it better to bring them into the workspace, or use the "Add Existing Files..." command?

        The drawback as I see it to bringing the files into the workspace is that they're all in a flat file structure. I know Qt does a great job managing them for you from Creator, but...there are times when a developer may wish to access the project from the file system, and having everything in one directory doesn't make that easy.

        So...is it better to add existing files and keep the workspace separate? The only drawback to this is that you get two levels of indirection: the one that Qt makes, and the one in your own directory structure. For example, I had a src subdirectory and a headers subdirectory, and they both appear under Sources and Headers, respectively, when I include them into the Qt project.

        Thanks for any opinions on this.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #24

          For me, that would depend on the logical units you can decern in the design. I think it makes sense to devide big projects in logical units that are relatively independant, and who's sources you group. You can do that in Qt just as well. Where it makes sense you might even, instead of directly including the files in such a unit in the .pro file, include the files for such a unit in a .pri file, and include() that in your .pro file. That way, the files will even appear grouped in Qt Creator, and you can work with that group of file as a separate unit. I use this technique myself quite often.

          If you study the source layout of Qt itself, you'll notice not everything is in a single there either...

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #25

            I have my project organized in subdirs and divided in two qmake projects.

            Qt Creator shows you the files organized by file type (Sources, Headers, UI, Resources, etc.) - it more or less relates to the .pro variables.

            Under the file types, your files can be displayed according to the file system structure. Be sure to click on the icon !http://doc.qt.nokia.com/qtcreator-2.1/images/qtcreator-filter.png! and have "Simplify Tree" unchecked. See the "Qt Creator User Interface":http://doc.qt.nokia.com/qtcreator-2.1/creator-quick-tour.html docs for some more information.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #26

              Oh, OK...that's pretty slick. I think I'll delete my existing project and start over, with the files sorted into directories. Thanks.

              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