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. ComboBox filled using a model
Qt 6.11 is out! See what's new in the release blog

ComboBox filled using a model

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.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.
  • P Offline
    P Offline
    passtec
    wrote on last edited by
    #1

    I am filling my comboBox with a model built from my database.
    But I would like to know how to get the current object selected.

    Does anybody have an idea ?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      welcome to devnet

      Would (see "here":http://doc.qt.nokia.com/4.7/qcombobox.html#currentIndex-prop
      @void setCurrentIndex ( int index )@
      help?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fluca1978
        wrote on last edited by
        #3

        You can get the "current index ":http://doc.qt.nokia.com/latest/qcombobox.html#currentIndex-propand then extract the index from your model. Or use currentText and do something similar.

        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