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?
QtWS25 Last Chance

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 492 Views
  • 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 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
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on 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
      2
      • p3c0P p3c0

        @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 last edited by
        #3

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

        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