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. Is their is any way so that a particular comment should appear in every cpp file?
Qt 6.11 is out! See what's new in the release blog

Is their is any way so that a particular comment should appear in every cpp file?

Scheduled Pinned Locked Moved Qt Creator and other tools
10 Posts 4 Posters 3.9k 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.
  • P Offline
    P Offline
    pratik041
    wrote on last edited by
    #1

    I have a particular format of comment i want to set that comment should appear in the beginning of every .cpp file i create. How can i do that?

    Pratik Agrawal

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

      Looking for a creator specific way (AFAIK : none!) ?

      And why copy-paste is so difficult?


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        p-himik
        wrote on last edited by
        #3

        You can go to Tools -> Options -> Text Editor -> Snippets. Create a new snippet with your comment.
        To insert it into a file just type the name of your snippet and press Ctrl+Space (or whatever shortcut you set for code completion). Voila, your comment is inserted.

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

          @p-himik : that was new to me.. thanks :) :)


          Declaration of (Platform) independence.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            p-himik
            wrote on last edited by
            #5

            Also you can create a licence template but Qt Creator will insert it into .h files too.
            Go to Tools -> Options -> C++ -> File Naming. Select there a file with your comment.

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pratik041
              wrote on last edited by
              #6

              Thank you Mr. p-himik

              Pratik Agrawal

              1 Reply Last reply
              0
              • P Offline
                P Offline
                p-himik
                wrote on last edited by
                #7

                Rahul Das, pratik041, you are welcome. Don't afraid to shin in the Options :) There are many interesting features.

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

                  :) :) No one is afraid.. But, yeah, its good to explore the tool.. Its just that, some like me are addicted to command line !!


                  Declaration of (Platform) independence.

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    pratik041
                    wrote on last edited by
                    #9

                    ya you are right but sometime asking question makes the thing more clear and you will be able to know new things what by mistake sometime missed.

                    Pratik Agrawal

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      fluca1978
                      wrote on last edited by
                      #10

                      I used also a small perl script to apply a license file at the beginning of each project file if I forgot to do from the beginning of the project.

                      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