3

I am looking for a way to show icon or image in QGIS Feature Attribute Form. I'm showing Equipment in Rack and if it is for example: 1. switch = show some icon 2. router = show different icon etc

Is such a thing possible?

enter image description here

4

I do not think it is possible in the default edit form to do this, however you could do the following using Qt Designer and python:

I gave a general presentation of how to create a custom edit form, see:

Python + QGIS + Qt = Field Data Collection App

  1. Create your own custom edit form in Qt Designer
  2. Add text box or combo box for each layer field
  3. Add label control and set image to label either within Qt Designer or using python to dyncamically set image.

Manually set image

If you are using Qt Designer - place a QLabel on your widget, select it, go to "Property Editor", scroll down to "QLabel" section. There will be a field titled "pixmap", push the "down arrow" on the right, there will be an option to "Choose file", then browse for your image.

To set image by python use setPixmap() method on label object

  1. Connect edit form to QGIS layer
  2. Create python file, add logic to python file (to dynamically update label picture based on related field value), and connect python file to QGIS layer
  • 1
    A great and well-prepared presentation =) – Joseph Dec 15 '17 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.