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. Scrolling combobox after it's been unfolded - is it possible?

Scrolling combobox after it's been unfolded - is it possible?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.1k 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on last edited by
    #1

    Imagine a QComboBox with n items visible on screen when it's dropped down (unfolded). The default behavior is that the current item is topmost, followed by next n-1 items (provided there are are enough items after the current one, of course).
    What I want is to scroll a combobox so that the current item is at the center of the list - with n/2 items before it and n/2-1 items after it being visible on screen. Is it possible?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From an educate guess: yes. You can create your own item view and model to set on the QComboBox so implementing such a behavior should be doable. However you are probably going to violate some user interface guidelines doing that which may also destabilize your user base.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Violet Giraffe
        wrote on last edited by
        #3

        That might be a diversion from the usual combo box behavior, but it will save my users a few clicks for an action that they perform most often.

        I can probably manipulate the combobox model, but how do I know it's been expanded? What event should I catch?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It'll be more of a view problem where you can catch the show event and the use of a proxy filter to rearrange your model data.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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