-
Notifications
You must be signed in to change notification settings - Fork 0
/
MultiSelectComboBox.h
45 lines (37 loc) · 1.13 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
43
44
45
#pragma once
#include <QComboBox>
#include <QListWidget>
#include <QDebug>
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();
void ResetCheckBoxState(const QString& text);
signals:
void selectionChanged();
public:
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 slots:
void stateChanged(int aState);
void onSearch(const QString& aSearchString);
void itemClicked(int aIndex);
private:
QListWidget* mListWidget;
QLineEdit* mLineEdit;
QLineEdit* mSearchBar;
};