Tulip  5.1.0
Large graphs analysis and drawing
TreeViewComboBox.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef TREEVIEWCOMBOBOX_H
23 #define TREEVIEWCOMBOBOX_H
24 
25 #include <QComboBox>
26 #include <QTreeView>
27 
28 #include <tulip/tulipconf.h>
29 
30 class TLP_QT_SCOPE TreeViewComboBox : public QComboBox {
31 
32  Q_OBJECT
33  QTreeView* _treeView;
34  bool _skipNextHide;
35  bool _popupVisible;
36  QModelIndex _lastIndex;
37 
38 public:
39  explicit TreeViewComboBox(QWidget *parent = NULL);
40 
41  void setModel(QAbstractItemModel * model);
42 
43  virtual void showPopup();
44  virtual void hidePopup();
45 
46  QModelIndex selectedIndex() const;
47 
48  bool eventFilter(QObject*, QEvent*);
49 
50 public slots:
51 
52  void selectIndex(const QModelIndex&);
53  void rowsRemoved(const QModelIndex&, int, int);
54  void currentIndexChanged();
55 
56 signals:
57 
58  void currentItemChanged();
59 
60 };
61 
62 #endif // TREEVIEWCOMBOBOX_H
63 ///@endcond