Forms

Custom entry form

  1. Choose File ‣ Open Project... from the menu bar

  2. Select QGIS-NaturalEarth-Example.qgs and press Open

  3. Zoom in somewhere to speed up redrawing

  4. Click Layer ‣ Add PostGIS Layer....

  5. Press Connect on NaturalEarth connection

  6. Select 10m_populated_places_simple in the table list

  7. Press Add and Close

  8. Double click 10m_populated_places_simple in the Layers tree

  9. Go to the tab Fields and set the Edit widget types:

    ../_images/forms_fields.png
  10. For the field ISO_A2 create a value map loading data from a layer:

    ../_images/forms_valuemap.png
  11. Activate the edit mode and digitize a point to see the new edit form:

    ../_images/forms_digitizing.png

Forms with QT Designer

QGIS supports also custom forms, created with the QT GUI Designer. QGIS relies on naming conventions for data fields and expressions. This allows QGIS to run forms created with QT designer without compilation.

For installing QT designer, open a terminal:

  1. Click Applications ‣ Accessories ‣ Terminal Emulator
  2. Type sudo apt-get install qt4-designer (Password: user)

Now we create a custom form with QT Designer:

  1. Click Applications ‣ Development ‣ QT 4 Designer

  2. Select “Dialog with Buttons Bottom”

    We follow the article on http://woostuff.wordpress.com/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/

    In our case we create an entry form “My custom places” with an entry field name and a read only key field gid

  3. Save it as places.ui in /home/user

Open QGIS again and:

  1. Double click 10m_populated_places_simple in the Layers tree
  2. Go to the tab General, choose /home/user/places.ui as Edit UI and press OK
  3. Activate the edit mode and digitize a point to see your new custom form

Table Of Contents

Previous topic

Raster calculator

Next topic

Table join

This Page