multicombobox.h
1 //------------------------------------------------------------------------------
2 // multicombobox.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2013 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef id61914372_2F5E_42A3_9CCC3ADF106B6FF2
24 #define id61914372_2F5E_42A3_9CCC3ADF106B6FF2
25 
26 #include <QComboBox>
27 
28 class QEvent;
29 
39 class MultiComboBox: public QComboBox
40 {
41  Q_OBJECT;
42 
43  public:
44  MultiComboBox(QWidget *widget = 0);
45  virtual ~MultiComboBox();
46  QString displayText() const;
47  bool eventFilter(QObject *object, QEvent *event);
48  virtual void paintEvent(QPaintEvent *);
49  QStringList selectedItemTexts() const;
50  void setSelectedTexts(const QStringList& texts);
51 
52  signals:
53  void valueChanged();
54 
55  private:
56  bool handleViewViewportEvent(QEvent* event);
57 };
58 
59 #endif