#ifndef MULTISELECTCOMBOBOX_H #define MULTISELECTCOMBOBOX_H #include #include #include #include #include class MultiSelectComboBox : public QComboBox { Q_OBJECT public: explicit MultiSelectComboBox(QWidget *parent = nullptr); void addItem(const QString &text); void addItems(const QStringList &texts); QStringList getSelectedItems() const; void setSelectedItems(const QStringList &items); bool allSelected() const; void clear(); signals: void selectionChanged(); protected: void hidePopup() override; bool eventFilter(QObject *watched, QEvent *event) override; private slots: void onItemPressed(const QModelIndex &index); void updateText(); private: QStandardItemModel *model; bool suppressUpdate; QLineEdit *displayLabel; }; #endif // MULTISELECTCOMBOBOX_H