Template files for new Qt Creator projects are available in the Qt Creator wizard when starting a new project. Custom wizards can be made using JSON files. This article gives a brief overview of Qt creator template files and Wizards. It also provides a way of speed up creating new projects.
Part 4 of the Qt Creator C++ Tutorial
Qt Creator Wizard New Project
A new project can be created in Qt creator using the New Project button on the Welcome page in Qt creator. Alternatively select File → New File or Project… from the top menu to start a new project.
After a new project is started, the New Project dialog box appears. This Qt Creator Wizard allows templates to be selected on which to base a new project. The following image shows the new project dialog box.
Custom Qt Creator Wizard Template Files
Currently there is no easy way to add new template files or wizards to Qt Creator. Qt Creator does not have the ability to export a project as a template, or to save a project as a template.
Reason for Wanting Custom Template Files
The main reason for wanting to create a set of custom template files for this tutorial series is to make it easy to start a new project with a blank window. When starting a new Qt Widgets Application, the new window always has three widgets placed on the window by default. These three widgets must be deleted for each new project.
No Quick and Easy Solution
I have not found an easy solution to make a template, so at the moment every project will be made using the existing wizard. The rest of this article just discusses what I have found out about the Qt Creator wizard. It also adds a tip to speed up new projects slightly.
How to Add a New Custom Wizard to Qt Creator
The official way to add a new custom wizard to Qt Creator is to manually create or modify a JSON file. When done correctly, a new custom set of template files appear in the new project dialog box.
Information on how to add a new custom wizard to Qt Creator can be found in the Qt documentation.
The path to the template files on a Linux Mint computer is:
Sets of template files that appear in the new project dialog box are found in the wizards directory.
Most of the projects in this tutorial series are based on the Qt Widgets Application template. Unfortunately there is no wizard template available for this type of project. This is because this wizard is hard coded into Qt Creator. Therefore it is not possible to use this template as a basis for a new Wizard.
Qt Creator Wizard Solution from Qt User
A user has provided some code for generating a project wizard from an existing project. I have not tried this code out yet.
Tip to Speed up New Qt Project Creation
A simple tip for speeding up new Qt project creation is to set the working project directory or folder. Doing this saves having to navigate to the project folder every time a new project is created.
In Qt Creator, click Tools → Options on the top menu.
Select Build & Run in the left pane.
Under the Projects Directory heading, select the Directory radio button. Use the Browse… button to navigate to your default project directory or folder.
Click the OK button to save the changes.
The image below shows changes made in the Options dialog box.