Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [Solved] QT designer 2.2.0 - SQL request in a Combo Box
Forum Updated to NodeBB v4.3 + New Features

[Solved] QT designer 2.2.0 - SQL request in a Combo Box

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 3.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VincentD
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      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)

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VincentD
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #4

          Always glad to help. And don't forget to add [Solved] in front of the title (by editing the first post).

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved