How to create a QComboBox that displays widgets?

  • Is it posible subclassing QComboBox enabling to display some functional widgets instead of only icons & text,...

    for example, clicking the combobox displays a bunch of QRadioButtons, or QPushButtons, images, ... customWidgets, etc all widgets within should be usable and functional.

    maybe a clue could be with QStandardItemModel but it still confusing for me.


    I should create a custom widget creating something like a combo QScrollarea and a QPushButton and manualy add some functionallity??

    maybe it's an obvious question but I'm a newbie and I want to take the correct path and learn from you guys

    In Advance

    Thank you!!!!!

  • Look at the examples for using QItemDelegate. A simple use of QItemDelegate can be found in the Qt examples/itmeviews/spinboxdelegate. You can find other examples on the web as well.

  • Hi draconis

    I ask you for huge apology for taking so long to respond,

    I've reviewed the examples and are quite clear, actually they gave me a clear track of how to do it.
    Now my problem is that the combobox does not paint the buttons or radiobuttons, I only managed to do it when I'm editing the item and thats when it is editable like within a qtableview, I wish that widgets (button, radiobuttons) where visible all the time.

    the documentation will help me.

    thank you very much for your help

  • You are welcome. Hope you are having success with your project.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.