showing slider in ComboBox using QML
Unsolved
QML and Qt Quick
-
So I have this combo box
but requirement is this
I need slider inside ComboBox since many entries..
any help/advise would be helpful..
-
Trying not to be pedantic, but slider is not correct, you are looking for 'scrollview'.
Similar to what you're asking, try this;
import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 Window { width: 50 height: 200 visible: true title: qsTr("Hello World") ScrollView { id: scrollview width: 100 height: 200 ListView { model: 2000 delegate: ItemDelegate { text: "Item " + index } header: headerComponent } Component { id: headerComponent Text { width: ListView.view.width height: 20 text: 'ALL' x: width/2 } } } }
-
@Markkyboy Thanks for correcting, I tried running above code but it is no different than what mine is, i.e. scrollview functionality is there by default in comboBox, what i am looking for is some indicator to show total items inside scrollview/combobox..
-
You can use the fact that the popup's contentItem of the ComboBox is a ListView and use ScrollBar
vertical
attached property:Binding { target: comboBox.popup.contentItem.ScrollBar property: "vertical" value: ScrollBar { policy: ScrollBar.AlwaysOn } }