Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Template for new C++ Class?
Forum Update on Monday, May 27th 2025

Template for new C++ Class?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 659 Views
  • 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.
  • M Offline
    M Offline
    MrShawn
    wrote on last edited by
    #1

    Hi all,

    Is there a way to better customize a template for creating new c++ class for the project? Much like when saying I want my class to inherit QObject it automatically adds the correct includes and fills in the parent class and adds the constructor components as well.

    When I use the <Custom> class it only fills in the parent class as :public <Custom> but does not include header and set up constructors properly - I have to do that manually every time. Is there a way I can automate this part when generating new C++ classes that inherit my custom class?

    Thanks in advance,
    -Shawn

    aha_1980A 1 Reply Last reply
    0
    • M MrShawn

      Hi all,

      Is there a way to better customize a template for creating new c++ class for the project? Much like when saying I want my class to inherit QObject it automatically adds the correct includes and fills in the parent class and adds the constructor components as well.

      When I use the <Custom> class it only fills in the parent class as :public <Custom> but does not include header and set up constructors properly - I have to do that manually every time. Is there a way I can automate this part when generating new C++ classes that inherit my custom class?

      Thanks in advance,
      -Shawn

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @MrShawn Looks like QTCREATORBUG-3855 ;)

      Qt has to stay free or it will die.

      1 Reply Last reply
      2
      • M Offline
        M Offline
        MrShawn
        wrote on last edited by
        #3

        Nooooooooo!!!!!!

        lol

        Oh well I am just making a template.h and template.cpp and I am just copy and pasting and replacing all Template->MyClass... That seems to work okay for now.

        Thanks!

        aha_1980A 1 Reply Last reply
        0
        • M MrShawn

          Nooooooooo!!!!!!

          lol

          Oh well I am just making a template.h and template.cpp and I am just copy and pasting and replacing all Template->MyClass... That seems to work okay for now.

          Thanks!

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @MrShawn Feel free to join the discussion at this bug, funnily it has recent activity despite beeing 8 years old.

          Qt has to stay free or it will die.

          M 1 Reply Last reply
          0
          • aha_1980A aha_1980

            @MrShawn Feel free to join the discussion at this bug, funnily it has recent activity despite beeing 8 years old.

            M Offline
            M Offline
            MrShawn
            wrote on last edited by
            #5

            @aha_1980

            I did add something, it is really weird that just today others have put comments... Thanks!

            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