Graphics Reference
In-Depth Information
self.viewMenu.addSeparator()
self.viewMenu.addAction(self.actionZoomIn)
self.viewMenu.addAction(self.actionZoomOut)
self.modeMenu.addAction(self.actionPan)
self.modeMenu.addAction(self.actionExplore)
self.toolBar.addAction(self.actionZoomIn)
self.toolBar.addAction(self.actionZoomOut)
self.toolBar.addAction(self.actionPan)
self.toolBar.addAction(self.actionExplore)
window.resize(window.sizeHint())
This module implements our Lex application's user interface, defining a QtAction ob-
ject for each toolbar and menu item, creating a widget to hold our map canvas, and laying
everything out within a QtMainWindow object. The structure of this module is identical
to the way Qt Designer and the pyuic4 command-line tool make a user interface tem-
plate available to Python code.
Notice that the Ui_ExplorerWindow class makes use of several toolbar icons. We will
need to create these icon images and define them in a resource description file, in the
same way we created a resources.py module in the previous chapter.
We are going to need the following icon images:
mActionZoomIn.png
mActionZoomOut.png
mActionPan.png
mActionExplore.png
If you want, you can download these image files in SVG format from the QGIS source
code repository ( https://github.com/qgis/QGIS/tree/master/images/themes/default ), though
you will need to convert them from .svg to .png in order to avoid issues with image
file formats. If you don't want to convert the icons yourself, the images are available as
part of the source code available with this topic. Once you are done, place these four files
in the main directory of your Lex application.
Search WWH ::




Custom Search