Skip to content

Commit 3cfcb79

Browse files
committedAug 7, 2011
Backport of 6e889aa

File tree

6 files changed

+178
-16
lines changed

6 files changed

+178
-16
lines changed
 

‎CODING

Lines changed: 166 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ Developers guide for QGIS
5858
3.4. The ADD_QGIS_TEST macro explained
5959
3.5. Building your unit test
6060
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
6369

6470

6571
------------------------------------------------------------------------
@@ -1208,7 +1214,163 @@ works in a truly platform way. I will update this document as things
12081214
progress.
12091215

12101216

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)
12121374
===================================
12131375

12141376
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.
12571419
suffixed to the button text.
12581420

12591421

1260-
5. Authors
1422+
6. Authors
12611423
==========
12621424

12631425
- Tim Sutton (author and editor)

‎CODING.pdf

344 KB
Binary file not shown.

‎INSTALL

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Quantum GIS (QGIS)
22
Building QGIS from source - step by step
3-
Sunday June 12, 2011
3+
Sunday August 07, 2011
44

55

6-
Last Updated: Sunday June 12, 2011
7-
Last Change : Sunday June 05, 2011
6+
Last Updated: Sunday August 07, 2011
7+
Last Change : Tuesday June 28, 2011
88

99

1010
1. Introduction
@@ -262,8 +262,8 @@ Now we create a build directory and run ccmake:
262262
When you run ccmake (note the .. is required!), a menu will appear where
263263
you can configure various aspects of the build. If you do not have root
264264
access or do not want to overwrite existing QGIS installs (by your
265-
packagemanager for example), set the CMAKE_BUILD_PREFIX to somewhere you
266-
have write access to (I usually use /home/timlinux/apps). Now press
265+
packagemanager for example), set the CMAKE_INSTALL_PREFIX to somewhere you
266+
have write access to (I usually use ${HOME}/apps). Now press
267267
'c' to configure, 'e' to dismiss any error messages that may appear.
268268
and 'g' to generate the make files. Note that sometimes 'c' needs to
269269
be pressed several times before the 'g' option becomes available.

‎INSTALL.pdf

274 Bytes
Binary file not shown.

‎doc/INSTALL.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545
<DIV CLASS="header" ID="header">
4646
<H1>Quantum GIS (QGIS)</H1>
4747
<H2>Building QGIS from source - step by step</H2>
48-
<H3>Sunday June 12, 2011</H3>
48+
<H3>Sunday August 07, 2011</H3>
4949
</DIV>
5050

5151
<DIV CLASS="body" ID="body">
5252
<P>
53-
Last Updated: Sunday June 12, 2011
54-
Last Change : Sunday June 05, 2011
53+
Last Updated: Sunday August 07, 2011
54+
Last Change : Tuesday June 28, 2011
5555
</P>
5656
<DIV CLASS="toc">
5757

@@ -409,8 +409,8 @@ <H2>3.7. Starting the compile</H2>
409409
When you run ccmake (note the .. is required!), a menu will appear where
410410
you can configure various aspects of the build. If you do not have root
411411
access or do not want to overwrite existing QGIS installs (by your
412-
packagemanager for example), set the CMAKE_BUILD_PREFIX to somewhere you
413-
have write access to (I usually use /home/timlinux/apps). Now press
412+
packagemanager for example), set the CMAKE_INSTALL_PREFIX to somewhere you
413+
have write access to (I usually use ${HOME}/apps). Now press
414414
'c' to configure, 'e' to dismiss any error messages that may appear.
415415
and 'g' to generate the make files. Note that sometimes 'c' needs to
416416
be pressed several times before the 'g' option becomes available.

‎doc/linux.t2t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ ccmake ..
162162
When you run ccmake (note the .. is required!), a menu will appear where
163163
you can configure various aspects of the build. If you do not have root
164164
access or do not want to overwrite existing QGIS installs (by your
165-
packagemanager for example), set the CMAKE_BUILD_PREFIX to somewhere you
166-
have write access to (I usually use /home/timlinux/apps). Now press
165+
packagemanager for example), set the CMAKE_INSTALL_PREFIX to somewhere you
166+
have write access to (I usually use ${HOME}/apps). Now press
167167
'c' to configure, 'e' to dismiss any error messages that may appear.
168168
and 'g' to generate the make files. Note that sometimes 'c' needs to
169169
be pressed several times before the 'g' option becomes available.

0 commit comments

Comments
 (0)
Please sign in to comment.