Book Image

Building Mapping Applications with QGIS

By : Erik Westra
Book Image

Building Mapping Applications with QGIS

By: Erik Westra

Overview of this book

Table of Contents (16 chapters)
Building Mapping Applications with QGIS
About the Author
About the Reviewers
Free Chapter
Getting Started with QGIS

Adding the user interface

Now that our program is running, we can start implementing the user interface (UI). A typical PyQt application will make use of Qt Designer to store the application's UI in a template file, which is then compiled into a Python module for use within your application.

As it would take many pages to describe how to use Qt Designer to lay out our window with its toolbar and menus, we're going to cheat and create our user interface directly within Python. At the same time, however, we'll create our UI module as if it was created using Qt Designer; this keeps our application's UI separate, and also shows how our application would work if we were to use Qt Designer to design our user interface.

Create a new module called, and type the following code into this module:

from PyQt4 import QtGui, QtCore

import resources

class Ui_ExplorerWindow(object):
    def setupUi(self, window):
        window.setWindowTitle("Landmark Explorer")