@@ -58,8 +58,14 @@ Developers guide for QGIS
58
58
3.4. The ADD_QGIS_TEST macro explained
59
59
3.5. Building your unit test
60
60
3.6. Run your tests
61
- 4. HIG (Human Interface Guidelines)
62
- 5. Authors
61
+ 4. Getting up and running with QtCreator and QGIS
62
+ 4.1. Installing QtCreator
63
+ 4.2. Setting up your project
64
+ 4.3. Setting up your build environment
65
+ 4.4. Setting your run environment
66
+ 4.5. Running and debugging
67
+ 5. HIG (Human Interface Guidelines)
68
+ 6. Authors
63
69
64
70
65
71
------------------------------------------------------------------------
@@ -1208,7 +1214,163 @@ works in a truly platform way. I will update this document as things
1208
1214
progress.
1209
1215
1210
1216
1211
- 4. HIG (Human Interface Guidelines)
1217
+ 4. Getting up and running with QtCreator and QGIS
1218
+ =================================================
1219
+
1220
+ QtCreator is a newish IDE from the makers of the Qt library. With QtCreator you
1221
+ can build any C++ project, but it's really optimised for people working on
1222
+ Qt(4) based applications (including mobile apps). Everything I describe below
1223
+ assumes you are running Ubuntu 11.04 'Natty'.
1224
+
1225
+
1226
+ 4.1. Installing QtCreator
1227
+ =========================
1228
+
1229
+ This part is easy:
1230
+
1231
+ sudo apt-get install qtcreator qtcreator-doc
1232
+
1233
+ After installing you should find it in your gnome menu.
1234
+
1235
+
1236
+ 4.2. Setting up your project
1237
+ ============================
1238
+
1239
+ I'm assuming you have already got a local Quantum-GIS clone containing the
1240
+ source code, and have installed all needed build dependencies etc. There are
1241
+ detailed in instructions on doing that here:
1242
+
1243
+ http://github.com/qgis/Quantum-GIS/blob/master/CODING
1244
+
1245
+ On my system I have checked out the code into $HOME/dev/cpp/Quantum-GIS and the
1246
+ rest of the article is written assuming that, you should update these paths as
1247
+ appropriate for your local system.
1248
+
1249
+ On launching QtCreator do:
1250
+
1251
+ File->Open File or Project
1252
+
1253
+ Then use the resulting file selection dialog to browse to and open this file:
1254
+
1255
+ $HOME/dev/cpp/Quantum-GIS/CMakeLists.txt
1256
+
1257
+ [images/image01.jpeg]
1258
+
1259
+ Next you will be prompted for a build location. I create a specific build dir
1260
+ for QtCreator to work in under:
1261
+
1262
+ $HOME/dev/cpp/Quantum-GIS/build-master-qtcreator
1263
+
1264
+ Its probably a good idea to create separate build directories for different
1265
+ branches if you can afford the disk space.
1266
+
1267
+ [images/image02.jpeg]
1268
+
1269
+ Next you will be asked if you have any CMake build options to pass to CMake. We
1270
+ will tell CMake that we want a debug build by adding this option:
1271
+
1272
+ -DCMAKE_BUILD_TYPE=Debug
1273
+
1274
+ [images/image03.jpeg]
1275
+
1276
+ Thats the basics of it. When you complete the Wizard, QtCreator will start
1277
+ scanning the source tree for autocompletion support and do some other
1278
+ housekeeping stuff in the background. We want to tweak a few things before we
1279
+ start to build though.
1280
+
1281
+
1282
+ 4.3. Setting up your build environment
1283
+ ======================================
1284
+
1285
+ Click on the 'Projects' icon on the left of the QtCreator window.
1286
+
1287
+ [images/image04.jpeg]
1288
+
1289
+ Select the build settings tab (normally active by default).
1290
+
1291
+ [images/image05.jpeg]
1292
+
1293
+ We now want to add a custom process step. Why? Because QGIS can currently only
1294
+ run from an install directory, not its build directory, so we need to ensure
1295
+ that it is installed whenever we build it. Under 'Build Steps', click on the
1296
+ 'Add Build Step' combo button and choose 'Custom Process Step'.
1297
+
1298
+ [images/image06.jpeg]
1299
+
1300
+ Now we set the following details:
1301
+
1302
+ Enable custom process step [yes]
1303
+ Command: make
1304
+ Working directory: $HOME/dev/cpp/Quantum-GIS/build-master-qtcreator
1305
+ Command arguments: install
1306
+
1307
+ [images/image07.jpeg]
1308
+
1309
+ You are almost ready to build. Just one note: QtCreator will need write
1310
+ permissions on the install prefix. By default (which I am using here) QGIS is
1311
+ going to get installed to /usr/local. For my purposes on my development
1312
+ machine, I just gave myself write permissions to the /usr/local directory.
1313
+
1314
+ To start the build, click that big hammer icon on the bottom left of the
1315
+ window.
1316
+
1317
+ [images/image08.jpeg]
1318
+
1319
+
1320
+ 4.4. Setting your run environment
1321
+ =================================
1322
+
1323
+ As mentioned above, we cannot run QGIS from directly in the build directly, so
1324
+ we need to create a custom run target to tell QtCreator to run QGIS from the
1325
+ install dir (in my case /usr/local/). To do that, return to the projects
1326
+ configuration screen.
1327
+
1328
+ [images/image04.jpeg]
1329
+
1330
+ Now select the 'Run Settings' tab
1331
+
1332
+ [images/image09.jpeg]
1333
+
1334
+ We need to update the default run settings from using the 'qgis' run
1335
+ configuration to using a custom one.
1336
+
1337
+ [images/image10.jpeg]
1338
+
1339
+ Do do that, click the 'Add v' combo button next to the Run configuration
1340
+ combo and choose 'Custom Executable' from the top of the list.
1341
+
1342
+ [images/image11.jpeg]
1343
+
1344
+ Now in the properties area set the following details:
1345
+
1346
+ Executable: /usr/local/bin/qgis
1347
+ Arguments :
1348
+ Working directory: $HOME
1349
+ Run in terminal: [no]
1350
+ Debugger: C++ [yes]
1351
+ Qml [no]
1352
+
1353
+ Then click the 'Rename' button and give your custom executable a meaning full
1354
+ name e.g. 'Installed QGIS'
1355
+
1356
+ [images/image12.jpeg]
1357
+
1358
+
1359
+ 4.5. Running and debugging
1360
+ ==========================
1361
+
1362
+ Now you are ready to run and debug QGIS. To set a break point, simply open a
1363
+ source file and click in the left column.
1364
+
1365
+ [images/image14.jpeg]
1366
+
1367
+ Now launch QGIS under the debugger by clicking the icon with a bug on it in the
1368
+ bottom left of the window.
1369
+
1370
+ [images/image13.jpeg]
1371
+
1372
+
1373
+ 5. HIG (Human Interface Guidelines)
1212
1374
===================================
1213
1375
1214
1376
In order for all graphical user interface elements to appear consistant and to
@@ -1257,7 +1419,7 @@ guidelines are followed in layout and design of GUIs.
1257
1419
suffixed to the button text.
1258
1420
1259
1421
1260
- 5 . Authors
1422
+ 6 . Authors
1261
1423
==========
1262
1424
1263
1425
- Tim Sutton (author and editor)
0 commit comments