Qt Creator Wt Application
This page describes the standard technique used within SPT to create Wt based web applications. Wt is a powerful and easy to use API (designed to be very similar to Qt) for developing rich internet applications. Unlike our other favourite web application framework Echo, Wt can be used to develop standard page oriented web sites as well.
Create Wt Application Project
- Create a new application project using the Qt Creator new project assistant, or by creating a text file similar to admin.pro. If you used the assistant to create the project, you will need to remove the Qt settings (follow the configuration in admin.pro).
- Add source files (and other resource files) to your library as appropriate.
- You can now build the sources for your project.
The next step is to configure Qt Creator to Run the Wt application. We have split it into two steps.
- Create a install.sh script that will copy over the required resource files into the build directory. This is the directory from which the application executable is launched.
- Optionally create a stop.sh script that will stop an existing Wt application that has been spawned. We find this helpful to make sure that the running Wt application is killed before the next run. It is quite easy to forget stopping the executable from the Qt Creator run pane before our next develop/test cycle.
- Add a Custom Process Step to the Run Settings and point it to the install.sh script. You may chose to execute the stop.sh script before you run the newly built executable.
- Set up the Executable, Arguments, and Working directory as appropriate.
- See Run Settings for a sample of how we set up the custom process step and the executable for one of our applications.
- Execute the Wt application using the Run button/menu. The Application Output pane will show the details of the running Wt application.
- Visit http://localhost:9080/ to view the built Wt application. Replace 9080 with the port that you specified in the Run Settings.
With this simple configuration, you can use Qt Creator to build and run your Wt applications. Follow the instructions from Qt Creator Static Library With Unit Test Suite if you wish to add a unit test suite, or link to another static library project.