-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMultiSelectComboBox.h
42 lines (34 loc) · 1.1 KB
/
MultiSelectComboBox.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include <QComboBox>
#include <QListWidget>
class MultiSelectComboBox : public QComboBox
{
Q_OBJECT
public:
MultiSelectComboBox(QWidget* aParent = Q_NULLPTR);
void addItem(const QString& aText, const QVariant& aUserData = QVariant());
void addItems(const QStringList& aTexts);
QStringList currentText();
int count() const;
void hidePopup() override;
void SetSearchBarPlaceHolderText(const QString& aPlaceHolderText);
void SetPlaceHolderText(const QString& aPlaceHolderText);
void ResetSelection();
signals:
void selectionChanged();
public slots:
void clear();
void setCurrentText(const QString& aText);
void setCurrentText(const QStringList& aText);
protected:
void wheelEvent(QWheelEvent* aWheelEvent) override;
bool eventFilter(QObject* aObject, QEvent* aEvent) override;
void keyPressEvent(QKeyEvent* aEvent) override;
private:
void stateChanged(int aState);
void onSearch(const QString& aSearchString);
void itemClicked(int aIndex);
QListWidget* mListWidget;
QLineEdit* mLineEdit;
QLineEdit* mSearchBar;
};