Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I include a form created in Designer in my QGIS plugin?

And how to get controls values (textbox,label,etc)?

share|improve this question

One approach is to load the .ui file dynamically:

    # load the form
    path = os.path.dirname( os.path.abspath( __file__ ) )
    self.optionsDialog = uic.loadUi(os.path.join(path,"options.ui"))

    # restore some options

    # show dialog

You can have a look at the corresponding full source code here:

share|improve this answer
Thank you! I was able to download the form, but I do not understand how can I assign, for example, a textBrowser value? – Cathrin Jun 21 '12 at 10:01
As posted in the example above: There most likely is a .setValue() function. You have to assign names to the UI parts in Designer, like "spinBoxFrameLength" in the example. – underdark Jun 22 '12 at 6:41
I can not find where the assigned value "spinBoxFrameLength". <<self.optionsDialog.spinBoxFrameLength.setValue(animationFrameLength) >> is it? what value it takes in this case? – Cathrin Jun 22 '12 at 6:46
I have an error occurs. swears at "setValue" . << AttributeError: 'QTextBrowser' object has no attribute 'setValue' >> – Cathrin Jun 22 '12 at 6:52
QTextBrowser has a setDocument() function. If you want to write plugins you will have to learn to use the Qt documentation – underdark Jun 22 '12 at 7:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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