Search code examples
c++qtqcombobox

QT Combo Box of Line Pattern


i want to make a line pattern combo box in Qt same as it is shown in the picture , please tell me is it possible to make a combo box in Qt like shown in the picture. Any help would be appreciated

Regards

enter image description here


Solution

  • Easy way:

    comboBox->setIconSize(QSize(100, 24));
    comboBox->addItem(lineIcon, "");
    comboBox->addItem(dotLineIcon, "");
    comboBox->addItem(dashLineIcon, "");
    ...
    

    Correct way:

    comboBox->setItemDelegate(...);