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. [SOLVED] customizing templates for source/header files
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] customizing templates for source/header files

Scheduled Pinned Locked Moved Qt Creator and other tools
22 Posts 6 Posters 18.7k 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.
  • B Offline
    B Offline
    bobby
    wrote on last edited by
    #10

    I don't have access to a Mac right now but try opening the terminal utility and run:

    @
    find / -iname 'qt4project'
    @

    Then it should give you the path to that template

    "Linux is not user-friendly." It is user-friendly. It is not ignorant-friendly and idiot-friendly.
    ---Source unknown

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

      Hi, Bobby -

      I tried that, and got reams of output. Is there a way to filter out the extraneous information?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bobby
        wrote on last edited by
        #12

        try looking for 'qtquick10'

        "Linux is not user-friendly." It is user-friendly. It is not ignorant-friendly and idiot-friendly.
        ---Source unknown

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

          @sh-3.2# find / -iname '*qtquick10'
          find: /dev/fd/3: Not a directory
          find: /dev/fd/4: Not a directory
          sh-3.2#
          @

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rahul Das
            wrote on last edited by
            #14

            I dont know much about Qt on Mac, But have you checked /usr/local/Trolltech/Qt-4.7.2/ or something similar to this ?


            Declaration of (Platform) independence.

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

              Hi, Rahul –

              I don't have a Trolltech directory under /usr/local.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Rahul Das
                wrote on last edited by
                #16

                Based on this "doc":http://doc.qt.nokia.com/4.7-snapshot/install-mac.html, You would have set the PATH during installation i guess. So, looking at PATH may give u hint..


                Declaration of (Platform) independence.

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

                  I have no idea what's going on now. I just installed the new release, and I still don't have a Trolltech directory anywhere that I can find.

                  Here's where I installed it, and what I got:

                  @Macintosh-d49a20f3c0dc:Qt mzimmers$ pwd
                  /Volumes/64_GB_SSD/Developer/Applications/Qt
                  Macintosh-d49a20f3c0dc:Qt mzimmers$ ls
                  Assistant.app InstallationLog.txt SDKMaintenanceTool.ini
                  Changelog.txt Licenses Simulator
                  Demos Madde Symbian
                  Desktop Qt Creator.app components.xml
                  Documentation SDKMaintenanceTool.app readme
                  Examples SDKMaintenanceTool.dat
                  @

                  It wanted to install into a directory under my username, but I prefer keeping my apps in a more centralized location.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    lgeyer
                    wrote on last edited by
                    #18

                    Qt Creator.app might be an "application bundle":http://en.wikipedia.org/wiki/Application_bundle#Mac_OS_X_application_bundles, "containing":http://www.mactipsandtricks.com/articles/Wiley_HT_appBundles.lasso all the files for Qt Creator, including the ones you are looking for.

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

                      You will find the templates for the stand alone Qt Creator app in

                      @
                      /Applications/Qt Creator.app/Contents/Resources/templates
                      @

                      The templates for the C++ files are in the subfolder "qt4project".

                      Replace "/Applications" with the folder where you have put the Qt Creator binary.

                      The path may be different for SDK downloads, I never checked those.

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

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

                        Hey, thanks, Volker:

                        Here's the contents of my folder:
                        @Macintosh-d49a20f3c0dc:qt4project mzimmers$ ls
                        customwidgetwizard mywidget.h widget.ui
                        main.cpp mywidget_form.cpp
                        mywidget.cpp mywidget_form.h
                        Macintosh-d49a20f3c0dc:qt4project mzimmers$
                        @

                        Neither of the .h files seem to match what I get when I create a new .h file. Do the default contents for new files come from somewhere else, perhaps?

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

                          I just checked the sources. The contents of a new header file is hard coded into Qt Creator. It is always of the format

                          @
                          #ifndef FILENAME_IN_UPPER_CASE_H
                          #define FILENAME_IN_UPPER_CASE_H

                          #endif // FILENAME_IN_UPPER_CASE_H
                          @

                          The only thing you can customize is a license template, that is prepended on the very top of the file.

                          The same holds for a single new C++ source file, with the exception, that this one is plain empty (it only contains a single newline, and optionally the license template).

                          I'm sorry - you will either need to hack Qt Creator (in file qt-creator-master/src/plugins/cppeditor/cppfilewizard.cpp) or live with the current "template".

                          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

                            OK, I can live with that (though I do find it a bit surprising that it's not configurable).

                            This is actually good news in a way...during the fact-finding while this thread was going on, I was starting to think I was crazy.

                            Thanks, V.

                            mz

                            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