Loading...
Searching...
No Matches
QueryBuilderWidget.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/query/QueryBuilderWidget.h
22
23 \brief This file has the QueryBuilderWidget class.
24*/
25
26#ifndef __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_QUERYBUILDERWIDGET_H
27#define __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_QUERYBUILDERWIDGET_H
28
29// TerraLib
30#ifndef Q_MOC_RUN
31#include "../../../dataaccess/dataset/DataSetType.h"
32#include "../../../dataaccess/datasource/DataSource.h"
33#include "../../../dataaccess/query/Expression.h"
34#include "../../../dataaccess/query/Where.h"
35#include "../Config.h"
36#endif
37
38// STL
39#include <memory>
40#include <map>
41
42// Qt
43#include <QWidget>
44#include <QTreeWidgetItem>
45
46
47namespace Ui { class QueryBuilderWidgetForm; }
48
49namespace te
50{
51 namespace qt
52 {
53 namespace widgets
54 {
55 class QueryBuilderTreeWidget;
56 class QueryConnectorWidget;
57 class QueryConditionWidget;
58
59 /*!
60 \class QueryBuilderWidget
61
62 \brief This class is used to define the Where Clause object of select operation.
63 */
65 {
66 Q_OBJECT
67
68 public:
69
70 QueryBuilderWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
71
73
74 void setInputParameters(te::da::DataSourcePtr dataSource, std::string dataSetName, std::unique_ptr<te::da::DataSetType> dsType);
75
77
79
81
82 std::string getWhereString();
83
84 protected:
85
86 QWidget * createCondition(bool startCondition, QWidget* parent, bool right);
87
88 QWidget* createConnector(bool startCondition, QWidget* owner, QWidget* parent, bool autoCreateCondition);
89
91
93
94 void rebuildTree(QTreeWidgetItem* item);
95
96 void buildTree(te::da::Expression* exp, QWidget* parent, bool right);
97
99
101
102 protected slots:
103
104 void onAddConnectorClicked(QWidget* owner, QWidget* parent);
105
106 void onRemoveConnectorClicked(QWidget* owner, QWidget* parent);
107
108 void onChanged();
109
110 signals:
111
112 void strWhereClause(std::string str);
113
114
115 protected:
116
117 std::unique_ptr<Ui::QueryBuilderWidgetForm> m_ui;
118
120
122
124
125 std::string m_dataSetName;
126
127 std::unique_ptr<te::da::DataSetType> m_dsType;
128
129 std::map<QTreeWidgetItem*, QWidget*> m_widgetMap;
130
131 };
132
133 } // end namespace widgets
134 } // end namespace qt
135} // end namespace te
136
137#endif // __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_QUERYBUILDERWIDGET_H
This is an abstract class that models a query expression.
Definition: Expression.h:48
A class that models a Function expression.
Definition: Function.h:48
A class that can be used to model a filter expression that can be applied to a query.
Definition: Where.h:48
This class is used to define the Query Builder Tree Widget.
This class is used to define the Where Clause object of select operation.
std::map< QTreeWidgetItem *, QWidget * > m_widgetMap
bool functionsIsAConnector(te::da::Function *func)
QWidget * createCondition(bool startCondition, QWidget *parent, bool right)
QWidget * createConnector(bool startCondition, QWidget *owner, QWidget *parent, bool autoCreateCondition)
void removeConnector(te::qt::widgets::QueryConnectorWidget *connector)
void buildTree(te::da::Expression *exp, QWidget *parent, bool right)
QueryBuilderTreeWidget * m_treeWidget
void removeCondition(te::qt::widgets::QueryConditionWidget *condition)
void strWhereClause(std::string str)
std::unique_ptr< Ui::QueryBuilderWidgetForm > m_ui
bool functionsIsACondition(te::da::Function *func)
std::unique_ptr< te::da::DataSetType > m_dsType
void setWhereClause(te::da::Where *where)
void rebuildTree(QTreeWidgetItem *item)
void onAddConnectorClicked(QWidget *owner, QWidget *parent)
void setInputParameters(te::da::DataSourcePtr dataSource, std::string dataSetName, std::unique_ptr< te::da::DataSetType > dsType)
QueryBuilderWidget(QWidget *parent=0, Qt::WindowFlags f=0)
void onRemoveConnectorClicked(QWidget *owner, QWidget *parent)
This class is used to define the Query Condition for a where clause.
This class is used to define the Query Connector for a where clause.
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
TerraLib.
#define slots
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63