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. [SOLVED] how to reset the combobox to its default state?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] how to reset the combobox to its default state?

Scheduled Pinned Locked Moved General and Desktop
12 Posts 4 Posters 20.2k 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.
  • K Offline
    K Offline
    kalster
    wrote on last edited by
    #1

    in the qt designer, i have added some items to the combobox. when the user selects an item from the combobox, i would like that item to be deselected and to display the first item at the top of the combobox again. i am asking if there is a way to reset the combobox back to its default state.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #2

      you mean, when the user click an item, you want to re-order the items and to put the selected one as the first index?


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kalster
        wrote on last edited by
        #3

        no. i ment that the combobox should look the way it was when the user first sees it. the scroll bar back up to the top and the first item is seen.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          So... you mean, that you would like to confuse the user into thinking your application is broken because the item he just selected suddenly is not selected anymore?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            The pure purpose of a combo box is to have the user select an option. Your UI design is awfully broken.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kalster
              wrote on last edited by
              #6

              no. you miss understand Volker, and Andre. the user selects and item in the combobox and the event is triggered. after the event, the combobox is reset to the default state. that is what i am trying to do.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Rahul Das
                wrote on last edited by
                #7

                if i understand it correctly , you are looking for setCurrentIndex ( int index ). That is, after every selection, the combobox shows the particular item, instead of the selected item.
                And if you reset this way with value -1 , the selection will be none.


                Declaration of (Platform) independence.

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kalster
                  wrote on last edited by
                  #8

                  ok. i thought that setCurrentIndex would set the index and not the item text. thank you Rahul Das. i marked this topic as solved :)

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #9

                    [quote author="kalster" date="1323577768"]no. you miss understand Volker, and Andre. the user selects and item in the combobox and the event is triggered. after the event, the combobox is reset to the default state. that is what i am trying to do.[/quote]

                    I understood it exactly this way and I stand that this is a horrible UI design. I as a user would be upset.

                    If I needed such a functionality, I would go with a context menu or a [[Doc:QToolButton]] with a menu. That looks more suitable for what you want to do and does not fool the user.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kalster
                      wrote on last edited by
                      #10

                      i have two comboboxs, one is for the user name and the other is for the user locations. when a different user name is selected, the user location combobox needs to change. i was asking how to change the user location but i understand how now.

                      i would agree that this is a bad ui design if i was using one combobox but i am using two comboboxs to function together.

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        goetz
                        wrote on last edited by
                        #11

                        Of course that make sense in that constellation. Sorry if it sounded a bit harsh before.

                        http://www.catb.org/~esr/faqs/smart-questions.html

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          kalster
                          wrote on last edited by
                          #12

                          that's ok Volker. I was just not too clear enough in this topic :)

                          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