[Solved] QT designer 2.2.0 - SQL request in a Combo Box
-
Hello,
I would like to create a user interface in QGIS (geographical information system software, developped in QT) with QT designer.
I can only join an ".ui " file to my QGIS project.
I thus created an interface with QT designer, who works (almost) perfectly.
My only problem comes from the ComboBox.
Is there a way to include a list which arises of a SQL request, or a text file?
(My list to be included contains several hundreds of items, I cannot enter them manually).
Thanks for help!Vincent
-
I have never used QGIS, but here's what I think.
As long as you list is static you can do the following:
All .ui files are basically just XML files and a QComboBox is represented by the following XML elelemt:
@
<widget class="QComboBox" name="name">
<item>
< property name="text">
<string>Test</string>
</property>
</item>
</widget>
@
As you can see an item is represented by a "<item>" tag. You could write a little tool that parses the text file and manipulates the .ui file accordingly. Does that help?P.S. the space between "<" and "property" is just to have it show up and not interpreted as an HTML tag (at least I think that's why i wouldn't show up otherwise)
-
Hello loladiro,
Yes, it works!!!!!!!
I've exported my PostGIS table in CSV format.
With search/replace functions in Notepad++, I 've added the tags around each item, and pasted the result in the .ui file.
Now my ComboBox shows items from my PostGIS table.Thank you very much!
Regards,
Vincent -
Always glad to help. And don't forget to add [Solved] in front of the title (by editing the first post).