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. Change QComboBox value
Qt 6.11 is out! See what's new in the release blog

Change QComboBox value

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.1k 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.
  • R Offline
    R Offline
    Rameshguru
    wrote on last edited by A Former User
    #1

    Our combox value contain some values like100, 200, 300 now i select 200 and lclose window then again open this window now our combobox index value is 200... how to do it please explain

    1 Reply Last reply
    0
    • RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by Ratzz
      #2

      @Rameshguru
      I think you are looking for this http://doc.qt.io/qt-4.8/qsettings.html
      how to use QSettings doc https://wiki.qt.io/How_to_Use_QSettings
      and http://stackoverflow.com/questions/28600271/saving-combination-of-qspinbox-and-qcombobox-using-qsettings
      This may help too http://www.qtcentre.org/threads/7984-Using-QSettings-to-populate-a-QComboBox

      --Alles ist gut.

      1 Reply Last reply
      3
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
        wrote on last edited by dheerendra
        #3

        When you close the window you need to store which item was selected earlier. You can use some thing called current index which is property of your combo box. Read current index in qcombobox documentation. When you open the window again use setcurrentindex method to the index which you saved. Look at currentindexchanged signal as well in qcombobox. If you want close the application completely and restart again look at option of qsetting as suggested in prev post

        Dheerendra
        @Community Service
        Certified Qt Specialist
        https://www.pthinks.com

        R 1 Reply Last reply
        9
        • dheerendraD dheerendra

          When you close the window you need to store which item was selected earlier. You can use some thing called current index which is property of your combo box. Read current index in qcombobox documentation. When you open the window again use setcurrentindex method to the index which you saved. Look at currentindexchanged signal as well in qcombobox. If you want close the application completely and restart again look at option of qsetting as suggested in prev post

          R Offline
          R Offline
          Rameshguru
          wrote on last edited by
          #4

          @dheerendra
          thank you sir

          1 Reply Last reply
          0
          • dheerendraD Offline
            dheerendraD Offline
            dheerendra
            Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
            wrote on last edited by
            #5

            @Rameshguru if issue is resolved can you move it to solved state

            Dheerendra
            @Community Service
            Certified Qt Specialist
            https://www.pthinks.com

            1 Reply Last reply
            2

            • Login

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