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