Skip to content
Browse files
Regenerated docs post raster-stats merge
  • Loading branch information
timlinux committed Aug 4, 2011
1 parent 58c737d commit 1c946725c1c6fdee05da6378bc42a0096318a2bf
@@ -58,8 +58,14 @@ Developers guide for QGIS
3.4. The ADD_QGIS_TEST macro explained
3.5. Building your unit test
3.6. Run your tests
4. HIG (Human Interface Guidelines)
5. Authors
4. Getting up and running with QtCreator and QGIS
4.1. Installing QtCreator
4.2. Setting up your project
4.3. Setting up your build environment
4.4. Setting your run environment
4.5. Running and debugging
5. HIG (Human Interface Guidelines)
6. Authors

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

4. HIG (Human Interface Guidelines)
4. Getting up and running with QtCreator and QGIS

QtCreator is a newish IDE from the makers of the Qt library. With QtCreator you
can build any C++ project, but it's really optimised for people working on
Qt(4) based applications (including mobile apps). Everything I describe below
assumes you are running Ubuntu 11.04 'Natty'.

4.1. Installing QtCreator

This part is easy:

sudo apt-get install qtcreator qtcreator-doc

After installing you should find it in your gnome menu.

4.2. Setting up your project

I'm assuming you have already got a local Quantum-GIS clone containing the
source code, and have installed all needed build dependencies etc. There are
detailed in instructions on doing that here:

On my system I have checked out the code into $HOME/dev/cpp/Quantum-GIS and the
rest of the article is written assuming that, you should update these paths as
appropriate for your local system.

On launching QtCreator do:

File->Open File or Project

Then use the resulting file selection dialog to browse to and open this file:



Next you will be prompted for a build location. I create a specific build dir
for QtCreator to work in under:


Its probably a good idea to create separate build directories for different
branches if you can afford the disk space.


Next you will be asked if you have any CMake build options to pass to CMake. We
will tell CMake that we want a debug build by adding this option:



Thats the basics of it. When you complete the Wizard, QtCreator will start
scanning the source tree for autocompletion support and do some other
housekeeping stuff in the background. We want to tweak a few things before we
start to build though.

4.3. Setting up your build environment

Click on the 'Projects' icon on the left of the QtCreator window.


Select the build settings tab (normally active by default).


We now want to add a custom process step. Why? Because QGIS can currently only
run from an install directory, not its build directory, so we need to ensure
that it is installed whenever we build it. Under 'Build Steps', click on the
'Add Build Step' combo button and choose 'Custom Process Step'.


Now we set the following details:

Enable custom process step [yes]
Command: make
Working directory: $HOME/dev/cpp/Quantum-GIS/build-master-qtcreator
Command arguments: install


You are almost ready to build. Just one note: QtCreator will need write
permissions on the install prefix. By default (which I am using here) QGIS is
going to get installed to /usr/local. For my purposes on my development
machine, I just gave myself write permissions to the /usr/local directory.

To start the build, click that big hammer icon on the bottom left of the


4.4. Setting your run environment

As mentioned above, we cannot run QGIS from directly in the build directly, so
we need to create a custom run target to tell QtCreator to run QGIS from the
install dir (in my case /usr/local/). To do that, return to the projects
configuration screen.


Now select the 'Run Settings' tab


We need to update the default run settings from using the 'qgis' run
configuration to using a custom one.


Do do that, click the 'Add v' combo button next to the Run configuration
combo and choose 'Custom Executable' from the top of the list.


Now in the properties area set the following details:

Executable: /usr/local/bin/qgis
Arguments :
Working directory: $HOME
Run in terminal: [no]
Debugger: C++ [yes]
Qml [no]

Then click the 'Rename' button and give your custom executable a meaning full
name e.g. 'Installed QGIS'


4.5. Running and debugging

Now you are ready to run and debug QGIS. To set a break point, simply open a
source file and click in the left column.


Now launch QGIS under the debugger by clicking the icon with a bug on it in the
bottom left of the window.


5. HIG (Human Interface Guidelines)

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

5. Authors
6. Authors

- Tim Sutton (author and editor)
@@ -1,10 +1,10 @@
Quantum GIS (QGIS)
Building QGIS from source - step by step
Sunday June 12, 2011
Thursday August 04, 2011

Last Updated: Sunday June 12, 2011
Last Change : Sunday June 05, 2011
Last Updated: Thursday August 04, 2011
Last Change : Tuesday June 28, 2011

1. Introduction
@@ -45,13 +45,13 @@
<DIV CLASS="header" ID="header">
<H1>Quantum GIS (QGIS)</H1>
<H2>Building QGIS from source - step by step</H2>
<H3>Sunday June 12, 2011</H3>
<H3>Thursday August 04, 2011</H3>

<DIV CLASS="body" ID="body">
Last Updated: Sunday June 12, 2011
Last Change : Sunday June 05, 2011
Last Updated: Thursday August 04, 2011
Last Change : Tuesday June 28, 2011
<DIV CLASS="toc">

@@ -1882,7 +1882,7 @@ void QgsRasterLayerProperties::refreshHistogram()
// bin in all selected layers, and the min. It then draws a scaled line between min
// and max - scaled to image height. 1 line drawn per selected band
const int BINCOUNT = 255;
const int BINCOUNT = 256;
bool myIgnoreOutOfRangeFlag = true;
bool myThoroughBandScanFlag = false;
int myBandCountInt = mRasterLayer->bandCount();
@@ -64,6 +64,10 @@ QString QgsApplication::mBuildOutputPath;
QgsApplication::QgsApplication( int & argc, char ** argv, bool GUIenabled, QString customConfigPath )
: QApplication( argc, argv, GUIenabled )
init( customConfigPath ); //initi can also be called directly by e.g. unit tests that dont inherit QApplication.
void QgsApplication::init( QString customConfigPath )
// check if QGIS is run from build directory (not the install directory)
QDir appDir( applicationDirPath() );
@@ -32,6 +32,10 @@ class CORE_EXPORT QgsApplication: public QApplication
QgsApplication( int & argc, char ** argv, bool GUIenabled, QString customConfigPath = QString() );
virtual ~QgsApplication();

/** This method initialises paths etc for QGIS. Called by the ctor or call it manually
when your app does not extend the QApplication class. */
static void init( QString customConfigPath = QString() );

//! Watch for QFileOpenEvent.
virtual bool event( QEvent * event );

0 comments on commit 1c94672

Please sign in to comment.