|
@@ -84,7 +84,7 @@ If you decide to install the Qt application natively on your computer, you can d
|
84
|
84
|
|
85
|
85
|
Qt is an application used by professional developers that has many possibilities and options. In each laboratory experience we will see how to use the basic options that we will need during the semester.
|
86
|
86
|
|
87
|
|
-In this laboratory experience we will learn how to use some of the basic functionalities of Qt Creator. We will be using Qt Creator mostly for editing and debugging our programs. However, Qt Creator also includes Qt Designer, the Qt tool for GUI layout/design which was used for designing the graphical interfaces for the laboratory experiences. Learning to use this tool is not part of this course, but you can learn to use it on your own. In [](https://docs.google.com/file/d/0B_6PcmpWnkFBOXJxVDlUNEVfOFk) you can find a presentation, prepared by the student Jonathan Vélez, that shows the basics of using Qt Creator and Qt Designer for designing graphical interfaces.
|
|
87
|
+In this laboratory experience we will learn how to use some of the basic functionalities of Qt Creator. We will be using Qt Creator mostly for editing and debugging our programs. However, Qt Creator also includes Qt Designer, the Qt tool for GUI layout/design which was used for designing the graphical interfaces for the laboratory experiences. Learning to use this tool is not part of this course, but you can learn to use it on your own. In [https://docs.google.com/file/d/0B_6PcmpWnkFBOXJxVDlUNEVfOFk](https://docs.google.com/file/d/0B_6PcmpWnkFBOXJxVDlUNEVfOFk) you can find a presentation, prepared by the student Jonathan Vélez, that shows the basics of using Qt Creator and Qt Designer for designing graphical interfaces.
|
88
|
88
|
|
89
|
89
|
|
90
|
90
|
|
|
@@ -92,11 +92,11 @@ In this laboratory experience we will learn how to use some of the basic functio
|
92
|
92
|
|
93
|
93
|
Each C++ project is composed of various types of files. In Qt you will have files of type *source, header, and form*.
|
94
|
94
|
|
95
|
|
-- **Source files:** These files have a `.cpp` extension (C plus plus) and contain the C++ code for your program. Among these files you will find `main.cpp`; this is the file the preprocessor will look for and its where your program starts. Another source file you will find in projects created with Qt is the `mainwindow.cpp` file; this file is created by Qt and contains the code associated with the main window designed with the design option (for example the functions that appear below "Private slots").
|
|
95
|
+- **Source files:** These files have a `.cpp` extension (C plus plus) and contain the C++ source code for your program. Among these files you will find `main.cpp`; this is the file that typically contains the main function the preprocessor will look for to start your program. Another source file you will find in projects created with Qt is the `mainwindow.cpp` file; this file is created by Qt and contains the implementation of the functions that control code associated with the main GUI window designed with the design option (for example the functions that appear below "Private slots").
|
96
|
96
|
|
97
|
|
-- **Header files:** These files have a `.h` extension and contain declarations of the functions that are used in the program. During the pre-processing of each program, the instruction `#include<name.h>` includes the contents of the file called "name.h" in the code for the `.cpp` file that contains this instruction.
|
|
97
|
+- **Header files:** These files have a `.h` extension and contain declarations of the functions that are used in the program.
|
98
|
98
|
|
99
|
|
-- **Form files:** These files have a `.ui` extension (user interface) and contain the forms created with the design option. A file you will find in projects created with Qt is the `mainwindow.ui` file; this file is created by Qt and contains the design for the main program window.
|
|
99
|
+- **Form files:** These files have a `.ui` extension (user interface) and contains a description of the controls and widgets included in the application's GUI.
|
100
|
100
|
|
101
|
101
|
|
102
|
102
|
---
|
|
@@ -106,7 +106,7 @@ Each C++ project is composed of various types of files. In Qt you will have file
|
106
|
106
|
|
107
|
107
|
## Laboratory session
|
108
|
108
|
|
109
|
|
-In today's laboratory experience you will practice the use of the some of the programs you will use during the semester. You will use the programs that are installed in the virtual machine.
|
|
109
|
+In this laboratory experience you will practice the use of the some of the programs you will use during the semester. You will use the programs that are installed in the virtual machine.
|
110
|
110
|
|
111
|
111
|
|
112
|
112
|
### Exercise 0: Create a directory for the laboratory files
|
|
@@ -119,7 +119,7 @@ Use the terminal and the command `mkdir` to create a directory `Documents/eip` f
|
119
|
119
|
|
120
|
120
|
#### Instructions
|
121
|
121
|
|
122
|
|
-1. To start a C++ project, press the `New Project` button or go to the Qt main menu and in `File` select `New File or Project`. A window similar to the one in Figure 2 will appear. Select `Non-Qt Project`, `Plain C++ Project` and press `Choose`.
|
|
122
|
+1. To start a C++ project, press the `New Project` button or go to the Qt Creator main menu and in `File` select `New File or Project`. A window similar to the one in Figure 2 will appear. Select `Non-Qt Project`, `Plain C++ Project` and press `Choose`.
|
123
|
123
|
|
124
|
124
|
---
|
125
|
125
|
|
|
@@ -141,7 +141,7 @@ Use the terminal and the command `mkdir` to create a directory `Documents/eip` f
|
141
|
141
|
|
142
|
142
|
---
|
143
|
143
|
|
144
|
|
-3. Return to the window where you can edit the program by selecting `Edit` in the left menu and double clicking `Sources` and then `main.cpp`. Press the green arrow on the left menu to execute the program. The results for the program will be displayed in the terminal window. If there were any errors, these would appear in the `Issues` window in Qt.
|
|
144
|
+3. Return to the window where you can edit the program by selecting `Edit` in the left menu and double clicking `Sources` and then `main.cpp`. Press the green arrow on the left menu to execute the program. The results for the program will be displayed in the terminal window. If there were any errors, these would appear in the `Issues` window in Qt Creator.
|
145
|
145
|
|
146
|
146
|
4. Change the contents of `main.cpp` to the following:
|
147
|
147
|
|
|
@@ -158,39 +158,39 @@ Use the terminal and the command `mkdir` to create a directory `Documents/eip` f
|
158
|
158
|
```
|
159
|
159
|
---
|
160
|
160
|
|
161
|
|
-1. Press the green button in the left menu to compile and execute the program. A window will appear that offers the option to store the changes. Press `Save all`. When executed, if you did not commit any errors, the program will display "I like the programming laboratory." in the terminal window.
|
|
161
|
+1. Press the green button in the left menu to compile and execute the program. A window will appear that offers the option to store the changes. Press `Save all`. When executed, if you did not make any mistakes, the program will display "I like the programming laboratory." in the terminal window.
|
162
|
162
|
|
163
|
163
|
|
164
|
164
|
### Exercise 2: Download projects from Bitbucket
|
165
|
165
|
|
166
|
|
-The files for this laboratory experience are stored in Bitbucket. In each laboratory session, you will download the Bitbucket folder that contains the files for that laboratory experience and you will save them in the `Documents/eip` directory you created in Exercise 0. To download the corresponding folder for this laboratory experience, open the terminal, use the Linux commands to move to the `Documents/eip` directory and write the command `git clone https://bitbucket.org/eip-uprrp/intro-introduction.git`. Go to the `Documents/eip` directory and verify that it contains the `intro-introduction` folder.
|
|
166
|
+The files for this laboratory experience are stored in Bitbucket. In each laboratory session, you will download the Bitbucket folder that contains the files for that laboratory experience and you will save them in the `Documents/eip` directory you created in Exercise 0. To download the corresponding folder for this laboratory experience, open the terminal, use the Linux commands to change directory to `Documents/eip` directory and execute the command `git clone https://bitbucket.org/eip-uprrp/intro-introduction.git`. Go to the `Documents/eip` directory and verify that it contains the `intro-introduction` folder.
|
167
|
167
|
|
168
|
168
|
|
169
|
169
|
### Exercise 3: Open project already created, compile and run
|
170
|
170
|
|
171
|
|
-In this exercise you will practice how to compile, fix errors, and execute a program using Qt.
|
|
171
|
+In this exercise you will practice how to compile, fix errors, and execute a program using Qt Creator.
|
172
|
172
|
|
173
|
173
|
|
174
|
174
|
#### Instructions
|
175
|
175
|
|
176
|
|
-1. First delete the files created by Qt and close the files from the previous project. To do this, in the Qt main menu go to `Build` and select `Clean all`; then go to `File` and select `Close all projects and editors`.
|
|
176
|
+1. First delete the files that were created by Qt during the building process and close the files from the previous project. To do this, in the Qt Creator main menu go to `Build` and select `Clean all`; then go to `File` and select `Close all projects and editors`.
|
177
|
177
|
|
178
|
178
|
2. Load the `QtCreator` project called `Practice` by double clicking the file `Practice.pro` in the `Documents/eip/introduction` directory on your computer. In the window that appears, press `Configure Project`.
|
179
|
179
|
|
180
|
180
|
Each time you load or start a new project, make sure that `Shadow build` is not selected: in the menu to the left, select `Projects`, then in `Build Settings` verify that the checkbox for `Shadow build` is not selected, as we saw in Figure 3.
|
181
|
181
|
|
182
|
|
-3. As you saw previously, Qt allows you to compile and execute a program by pressing the green arrow that appears in the left column. Press the arrow and notice that you obtain a window of "Issues" that occurred when compiling. The list that appears will show you information that allows you to find and fix the errors.
|
|
182
|
+3. As you saw previously, Qt allows you to build and execute a program by pressing the green arrow that appears in the left column. Press the arrow and notice that you obtain a window of "Issues" that occurred when building. The list that appears will show you information that allows you to find and fix the errors.
|
183
|
183
|
|
184
|
184
|
4. Select the `main.cpp` file in the `Sources` directory so you can find and fix the errors.
|
185
|
185
|
|
186
|
|
- Fix all of the errors and press the green arrow once again to compile and execute the program. Once you fix the errors, the program should open a window `Application Output` and display `Exit: 1`.
|
|
186
|
+ Fix all of the errors and press the green arrow once again to build and execute the program. Once you fix the errors, the program should open a window `Application Output` and display `Exit: 1`.
|
187
|
187
|
|
188
|
|
-5. As mentioned earlier, during the compilation and execution process, Qt creates various files we should delete after terminating the program. To do this, in the `Build` option of the Qt menu, select `Clean All`.
|
|
188
|
+5. As mentioned earlier, during the compilation and execution process, Qt creates various files we should delete after finishing the program. To do this, in the `Build` option of the Qt Creator menu, select `Clean All`.
|
189
|
189
|
|
190
|
190
|
|
191
|
191
|
### Exercise 4: Deliverables
|
192
|
192
|
|
193
|
|
-During each laboratory experience, each pair will hand in some of the results of their work. These deliveries will be done in the "Deliverables" section that appears on Moodle. Today each student will practice handing in their work individually.
|
|
193
|
+During each laboratory experience, each student will hand in some of the results of their work. These deliveries will be done in the "Deliverables" section that appears on Moodle. Today each student will practice handing in their work individually.
|
194
|
194
|
|
195
|
195
|
|
196
|
196
|
#### Instructions
|