Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

can someone help me with initial developing on qgis plugin that displays postgres data table on a QTTableView or QTTableWidget?

So far:

  • I can connect to database using psycopg2 or using QtSql(tested inside QGIS console)

  • Using idle i can't because it does not load the QPSQL drivers...although i have them on my qt binary install.

  • I'm using pluginbuilder for initial setup, but i don't know how to get a reference to my tablewidget, to pass data from sql query.

  • Using IDLE i can draw a form with a tablewidget that is filled with data from sel query.

I already read this question :(but still have doubts...)

I need help putting things together.

Thanks for reading.

UPDATE: In here if i run from terminal i can fill a qtablewidget with sql data:

I want to draw a widget like this inside a qgisplugin. My Plugin(TestPlugin) was buit with plugin builder, asnd inside my ui_testplugin.ui, i have a QtTableWidget draw with QtDesigner and compiled using a generated makefile. I know that i have to insert logic inside, inside run block, but i don't know to get a reference to QtTableWidget.

Hope this makes it clear. Thanks.

share|improve this question
What exactly is your question now? Where exactly are you stuck? Also show your code so far (smallest possible working example). – underdark Sep 28 '12 at 14:49
Have you tried gdal-dev mailing list? – nickves Sep 29 '12 at 0:43
Sorry, for my question, buy it don't think the problem is related to GDAL...Perhaps one of my problem has to do with my python path, and the way qtsql drivers are searched inside qgis console and normal shell. The other problem is that i don't know how to get a reference to widgets drawn with QtDesigner, inside main .py file on a qgis plugin. Thanks – Arthur Portas Sep 29 '12 at 11:10
Hi, following, tutorial, i've achieved my goal. I didn't understood that i can get a refrence to my gui widgets inside file, generated from QGis plugin builder. In here i can write functions and call them on my run block inside file. Ex: def setTextBrowser(self,output): self.ui.txtFeedback.setText(output) Thanks anyway. – Arthur Portas Sep 30 '12 at 0:26

Your Answer


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

Browse other questions tagged or ask your own question.