Unsolved How can i create my custom ComboBox?
-
HI:
I want to create custom combobox with my custom widgets.
For example custom objects locations, custom geometry.
How can i do this?
Regards.
-
@Yaldiz Depends on the amount of changes you want to do compared to standard combo box.
Also, are we talking about widgets or QML.
For widgets you can either subclass QComboBox and implement your changes or implement your own combo box from scratch. -
We are talking about widgets.
Can I change the default views with the method you specified?
If possible, can you share a source where I can get an example?
-
@Yaldiz said in How can i create my custom ComboBox?:
Can I change the default views with the method you specified?
I don't know what exactly you want to achieve.
What is "custom objects locations" (what objects?)?
What is "custom geometry"? -
A combobox where I can create the design with my own widgets, labels etc...
-
@Yaldiz This still not answers how / what you need different from a normal combobox. How should your combobox look like? What's not achievable with the normal one?
-
I want different stylesheets, for example I don't want default dropdown arrow, I want custom designed arrow I want to use my custom widgets, labels like combobox items
-
@Yaldiz said in How can i create my custom ComboBox?:
I want to use my custom widgets, labels like combobox items
See https://doc.qt.io/qt-5/qcombobox.html
"QComboBox uses the model/view framework for its popup list and to store its items. By default a QStandardItemModel stores the items and a QListView subclass displays the popuplist. You can access the model and view directly (with model() and view()), but QComboBox also provides functions to set and get item data (e.g., setItemData() and itemText()). You can also set a new model and view (with setModel() and setView()). For the text and icon in the combobox label, the data in the model that has the Qt::DisplayRole and Qt::DecorationRole is used. Note that you cannot alter the SelectionMode of the view(), e.g., by using setSelectionMode()."Regarding style see https://doc.qt.io/qt-5/stylesheet-syntax.html