CopperSpice Overview
Using Qt Creator

QtCreator is an integrated development environment which can be used to develop, compile, link, deploy, and run a C++ application using CopperSpice. The UI Designer is part of the IDE, allowing the developer to drag and drop widgets or controls on a window to create the graphical user interface for an application.

Adding a Kit (step one)

In order to compile and link an application, a kit must first be created and then configured. The kit contains information about the toolchain and where the compiler, linker, and debugger programs are located. These steps pertain to building with the CMake build system.

Open Qt Creator and then select Tools, Options. From the Kits tab click the Add button. We suggest you call your kit CopperSpice and set this as the default. This kit will be used for every project that is built with the CopperSpice libraries. The following is a list of the typical parameters.

Key Value
Name CopperSpice
Device Type Desktop
Device Local PC
Compiler C MinGW
Compiler C++ MinGW
Debugger None
Qt version None
Step 1A
Click on "Manage..." to modify the CMake build system
Click the Add button to create a new CMake entry. We suggest you call this CMake and set it as the default
Select the Browse button to locate the CMake.Exe path
Step 1B
Click on "Change..." to modify the "CMake Generator", select the Ninja generator
Step 1C
Click on "Change..." to modify the "CMake Configuration"
  • Set the CMAKE_PREFIX_PATH to the correct path
    • Default location is:   C:\CopperSpice\cmake\copperspice
  • Remove the QT_QMAKE_EXECUTABLE line

Working Directory (step two)

Set up a new location for the project files.

  • Create a folder where the new project will reside
  • Once the project has been configured using the following steps, any existing project files can be copied into this folder

Create Project (step three)

Use the following steps to create and configure a new project in Qt Creator.

  • Select File, then "New File or Project"
  • In the upper left select "Non-Qt Project"
  • In the middle of the screen select "Plain C++ Application", then click Choose
  • Enter the Project name and location, click Next
  • Select CMake for the build system, click Next
  • Select the CopperSpice kit configured in Step 1, then expand the Details
  • Edit the folder names as needed
  • Select the version control system as needed
  • Select Finish

Create Project (step four)

After the project has been created a very basic CMakeLists.txt will automatically be generated. This file should be replaced by a proper build file which uses at least CMake 3.16 and links with the CopperSpice libraries.

Refer to the following link for information on how to configure the CMake build files: CopperSpice Project Files

Develop Your Application (step five)

From here you add your source files then build and run your application/

If your application is designed to run in a terminal window you will need to check the box for "Run in Terminal" in Qt Creator. Select Projects, Run, and the checkbox will be located under the Run section.

These are a few extra settings you may need to set up for installing and deployment.

Project Install Location
Select the Project, Build & Run, Build
Under the CMake section locate the CMAKE_PREFIX_PATH
Edit the value to indicate where your project should be installed
Default location is:   C:\YourProject\deploy

Click the "Apply Configuration Changes"

Installing Your Project
Select the Project, Build & Run, Run
Select Add Deploy Step
Using the drop down box, pick Build

Ensure Install is checked

Running Your Application
Select the Project, Build & Run, Run
Select the Add drop down box, then Custom Executable
Enter the path to the executable file name in the deploy directory

Creating a UI file (step six)

Use the following steps to create a UI file where widgets and controls can be added to develop a GUI.

  • Select File, then "New File or Project"
  • In the lower left select "Qt"
  • In the middle of the screen select "Qt Designer Form", then click Choose
  • Choose the Form Template, "Main Window", then click Next
  • Adjust the Name and Path as required, click Next
  • Click on Finish