上QQ阅读APP看书,第一时间看更新
Time for action – Creating a Qt Widgets project
The first step to develop an application with Qt Creator is to create a project using one of the templates provided by the IDE.
From the File menu of Qt Creator, choose New File or Project. There are a number of project types to choose from. Follow the given steps for creating a Qt Desktop project:
- For a widget-based application, choose the Application group and the Qt Widgets Application template, as shown in the following screenshot:
- The next step is to choose a name and location for your new project:
- We will create a simple tic-tac-toe game, so we will name our project tictactoe and provide a nice location for it.
If you have a common directory where you put all your projects, you can tick the Use as default project location checkbox for Qt Creator to remember the location and suggest it the next time you start a new project.
- Next, you need to select the kit (or multiple kits) you want to use with the project. Select the Desktop Qt kit corresponding to the Qt version you want to use:
- Now you will be presented with the option of creating the first widget for your project. We want to create a widget that will represent the main window of our application, so we can leave the Class name and Base class fields unchanged. We also want to use the visual form editor to edit the content of the main window, so Generate form should also be left checked:
- Then, click on Next and Finish.