DataSetTreeView.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib 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 Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/dataset/explorer/DataSetTreeView.h
22 
23  \brief A tree view for datasets of a data source.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_DATASET_EXPLORER_INTERNAL_DATASETTREEVIEW_H
27 #define __TERRALIB_QT_WIDGETS_DATASET_EXPLORER_INTERNAL_DATASETTREEVIEW_H
28 
29 // TerraLib
30 #include "../../../../dataaccess/datasource/DataSourceInfo.h"
31 #include "../../Config.h"
32 
33 // STL
34 #include <list>
35 #include <memory>
36 
37 // Qt
38 #include <QTreeView>
39 
40 namespace te
41 {
42  namespace qt
43  {
44  namespace widgets
45  {
46  class DataSetGroupItem;
47  class DataSetCategoryGroupItem;
48  class DataSetItem;
49  class DataSetTreeModel;
50  class DataSetCategoryModel;
51 
52  /*!
53  \class DataSetTreeView
54 
55  \brief A tree view for datasets of a data source.
56 
57  \ingroup widgets
58 
59  \sa DataSetTreeViewModel, DataSetExplorer
60  */
61  class TEQTWIDGETSEXPORT DataSetTreeView : public QTreeView
62  {
63  Q_OBJECT
64 
65  public:
66 
67  DataSetTreeView(QWidget* parent = 0);
68 
69  ~DataSetTreeView();
70 
71  void set(const te::da::DataSourceInfoPtr& ds, bool useCheckableItems = false);
72 
73  std::list<DataSetItem*> getSelectedDataSets() const;
74 
75  bool hasSelectedDataSets() const;
76 
77  signals:
78 
79  void activated(DataSetItem* item);
80 
81  void activated(DataSetCategoryGroupItem* item);
82 
83  void activated(DataSetGroupItem* item);
84 
85  void clicked(DataSetItem* item);
86 
87  void clicked(DataSetCategoryGroupItem* item);
88 
89  void clicked(DataSetGroupItem* item);
90 
91  void doubleClicked(DataSetItem* item);
92 
93  void doubleClicked(DataSetCategoryGroupItem* item);
94 
95  void doubleClicked(DataSetGroupItem* item);
96 
97  void entered(DataSetItem* item);
98 
99  void entered(DataSetCategoryGroupItem* item);
100 
101  void entered(DataSetGroupItem* item);
102 
103  void pressed(DataSetItem* item);
104 
105  void pressed(DataSetCategoryGroupItem* item);
106 
107  void pressed(DataSetGroupItem* item);
108 
109  void toggled(DataSetItem* item);
110 
111  void toggled(DataSetCategoryGroupItem* item);
112 
113  void toggled(DataSetGroupItem* item);
114 
115  protected slots:
116 
117  void onItemActivated(const QModelIndex & index);
118 
119  void onItemClicked(const QModelIndex & index);
120 
121  void onItemDoubleClicked(const QModelIndex & index);
122 
123  void onItemEntered(const QModelIndex & index);
124 
125  void onItemPressed(const QModelIndex & index);
126 
127  void customContextMenu(const QPoint &point);
128 
129  void onModelToggled(bool checked);
130 
131  private:
132 
133  std::auto_ptr<DataSetCategoryModel> m_categoryModel;
134  std::auto_ptr<DataSetTreeModel> m_treeModel;
138  };
139  } // end namespace widgets
140  } // end namespace qt
141 } // end namespace te
142 
143 #endif // __TERRALIB_QT_WIDGETS_DATASET_EXPLORER_INTERNAL_DATASETTREEVIEW_H
te::da::DataSourceInfoPtr m_ds
std::auto_ptr< DataSetTreeModel > m_treeModel
URI C++ Library.
A tree view for datasets of a data source.
std::auto_ptr< DataSetCategoryModel > m_categoryModel
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr