[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
3 replies
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)
You must log in to post a reply. Not a member yet? Register here!

