Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
This simple 2D graphics program has the goal to create a colored gradient by setting the colors of individual pixels from a console application.
This guide is not yet finished: I haven't gotten it to work yet.
The screenshots from this guide are made using Qt Creator 1.3.1 running under Ubuntu 10.04.
|
To create this simple 2D graphics program from a console application in Qt Creator, you can follow the steps below:
- Step #1: Setting up the Qt4 Console application project
- Step #2: Coding the definition of main
- Step #3: Running the program
Step #1: Setting up the Qt4 Console application project
- Start Qt Creator.
- If you are not shown the welcome screen, click on 'Welcome' on the left
- If, in the welcome screen, the 'Develop' tab is not shown, click on 'Develop' to view the Welcome screen Develop tab
- In the Welcome screen Develop tab, click 'Create New Project' to go to the New project dialog
- In the New project dialog, click 'QT4 Gui Application' to go to the introduction and project location dialog
- In the Introduction and project location dialog, you must specify a name and location to save your (project) files. For example, after 'Name' type 'CppQt2dGraphicsConsole'. Click next
- In the select required modules dialog, make sure QtCore and QtGui are checked and click 'Next'
- In the project management dialog, click 'Finish'
Now your Qt4 Console application project is successfully set up. Your screen might look like this.
Your screen might look like this.
- On the left menu bar, you can see you are now in 'Edit' mode (instead of 'Welcome' mode). You can see your project right of this menu bar. You can see a 'CppQt2dGraphicsConsole' project folder, containing the following folders and files:
- CppQt2dGraphicsConsole.pro
- main.cpp (in folder 'Sources')
Double-click on 'main.cpp' to be taken to the code editor.
- Your screen then might look like this with the following source code:
- Change this code to the following:
Step #3: Running the program
- Press CTRL-R to start the program
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.
