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 #ifndef Q_MOC_RUN
31 #include "../../../../dataaccess/datasource/DataSourceInfo.h"
32 #endif
33 #include "../../Config.h"
34 
35 // STL
36 #include <list>
37 #include <memory>
38 
39 // Qt
40 #include <QTreeView>
41 
42 namespace te
43 {
44  namespace qt
45  {
46  namespace widgets
47  {
48  class DataSetGroupItem;
49  class DataSetCategoryGroupItem;
50  class DataSetItem;
51  class DataSetTreeModel;
52  class DataSetCategoryModel;
53 
54  /*!
55  \class DataSetTreeView
56 
57  \brief A tree view for datasets of a data source.
58 
59  \ingroup widgets
60 
61  \sa DataSetTreeViewModel, DataSetExplorer
62  */
63  class TEQTWIDGETSEXPORT DataSetTreeView : public QTreeView
64  {
65  Q_OBJECT
66 
67  public:
68 
69  DataSetTreeView(QWidget* parent = 0);
70 
71  ~DataSetTreeView();
72 
73  void set(const te::da::DataSourceInfoPtr& ds, bool useCheckableItems = false);
74 
75  std::list<DataSetItem*> getSelectedDataSets() const;
76 
77  bool hasSelectedDataSets() const;
78 
79  signals:
80 
81  void activated(DataSetItem* item);
82 
83  void activated(DataSetCategoryGroupItem* item);
84 
85  void activated(DataSetGroupItem* item);
86 
87  void clicked(DataSetItem* item);
88 
89  void clicked(DataSetCategoryGroupItem* item);
90 
91  void clicked(DataSetGroupItem* item);
92 
93  void doubleClicked(DataSetItem* item);
94 
95  void doubleClicked(DataSetCategoryGroupItem* item);
96 
97  void doubleClicked(DataSetGroupItem* item);
98 
99  void entered(DataSetItem* item);
100 
101  void entered(DataSetCategoryGroupItem* item);
102 
103  void entered(DataSetGroupItem* item);
104 
105  void pressed(DataSetItem* item);
106 
107  void pressed(DataSetCategoryGroupItem* item);
108 
109  void pressed(DataSetGroupItem* item);
110 
111  void toggled(DataSetItem* item);
112 
113  void toggled(DataSetCategoryGroupItem* item);
114 
115  void toggled(DataSetGroupItem* item);
116 
117  protected slots:
118 
119  void onItemActivated(const QModelIndex & index);
120 
121  void onItemClicked(const QModelIndex & index);
122 
123  void onItemDoubleClicked(const QModelIndex & index);
124 
125  void onItemEntered(const QModelIndex & index);
126 
127  void onItemPressed(const QModelIndex & index);
128 
129  void customContextMenu(const QPoint &point);
130 
131  void onModelToggled(bool checked);
132 
133  private:
134 
135  std::auto_ptr<DataSetCategoryModel> m_categoryModel;
136  std::auto_ptr<DataSetTreeModel> m_treeModel;
140  };
141  } // end namespace widgets
142  } // end namespace qt
143 } // end namespace te
144 
145 #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