Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why it only show 1 name in my database i have 5 what is wrong with my code?
Forum Updated to NodeBB v4.3 + New Features

Why it only show 1 name in my database i have 5 what is wrong with my code?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 509 Views 2 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on 20 Jan 2017, 15:45 last edited by VRonin
    #1
    self.query = QSqlQuery("SELECT name FROM test_table")
            #
            while(self.query.next()):
                self.cb = QComboBox(self)
                self.cb.addItem(self.query.value(0).toString())
            #
            
            self.show()
    
    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 20 Jan 2017, 17:16 last edited by
      #2

      @Gelo Not exactly sure about python but it seems you are creating a new QComboBox inside the loop everytime it iterates.

      157

      ? 1 Reply Last reply 20 Jan 2017, 17:55
      2
      • P p3c0
        20 Jan 2017, 17:16

        @Gelo Not exactly sure about python but it seems you are creating a new QComboBox inside the loop everytime it iterates.

        ? Offline
        ? Offline
        A Former User
        wrote on 20 Jan 2017, 17:55 last edited by
        #3

        @p3c0 Thank you! i already solve the problem ^_^

        1 Reply Last reply
        0

        1/3

        20 Jan 2017, 15:45

        • Login

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