Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ComboBox with many items (Countries)
Forum Updated to NodeBB v4.3 + New Features

ComboBox with many items (Countries)

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 2.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
    philk
    wrote on last edited by
    #1

    Over a hundred countries in a ComboBox element will create a slow and insanely big list when the dropdown is opened. Hot to show only 5 items in the list with a scrollbar?

    And as a bonus: how to make the ComboBox editable? So the user can select a country by typing?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MrMNight
      wrote on last edited by
      #2
      Please see "setMaxVisibleItems(int maxItems)":http://qt-project.org/doc/qt-5.0/qtwidgets/qcombobox.html#maxVisibleItems-prop and "setEditable(bool editable)":http://qt-project.org/doc/qt-5.0/qtwidgets/qcombobox.html#editable-prop methods
      
      1 Reply Last reply
      0
      • P Offline
        P Offline
        philk
        wrote on last edited by
        #3

        Uhmm I am not using the Widget in QML

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MrMNight
          wrote on last edited by
          #4

          sorry, didn't see that you want it in qml. Did you see that: "example":http://qt.gitorious.org/qt-components/qt-components/source/55b123e52c9975e089c1d936e0b05467779dd00e:ComboBox.qml ?
          i mean this parts of code:
          @
          ...
          property int elementsToShow: 5;
          ...
          Item {
          ...
          height: Math.min(background.height * elements.count,
          background.height * combobox.elementsToShow);
          //for combobox size
          ....
          Keys.onPressed: {
          ... //for selecting by typing
          }
          }
          @

          1 Reply Last reply
          0
          • P Offline
            P Offline
            philk
            wrote on last edited by
            #5

            This is qt-components code not official Qt code?

            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