Main Page
Modules
Namespaces
Classes
Files
File List
File Members
FieldsWizardPage.cpp
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/FieldsWizardPage.cpp
22
23
\brief This file has the FieldsWizardPage class.
24
*/
25
26
// TerraLib
27
#include "../../../dataaccess/query/Field.h"
28
#include "../../../dataaccess/query/PropertyName.h"
29
#include "../utils/DoubleListWidget.h"
30
#include "
FieldsWizardPage.h
"
31
#include "ui_DoubleListWidgetForm.h"
32
33
// Qt
34
#include <QGridLayout>
35
36
37
te::qt::widgets::FieldsWizardPage::FieldsWizardPage
(QWidget* parent)
38
: QWizardPage(parent)
39
{
40
m_widget
.reset(
new
DoubleListWidget
(
this
));
41
42
QGridLayout* layout =
new
QGridLayout(
this
);
43
44
layout->addWidget(
m_widget
.get());
45
46
//configure page
47
this->setTitle(tr(
"Attribute Selection"
));
48
this->setSubTitle(tr(
"Select the attributes to be listed."
));
49
50
m_widget
->getForm()->m_leftItemsLabel->setText(tr(
"Available Properties"
));
51
m_widget
->getForm()->m_rightItemsLabel->setText(tr(
"Used Properties"
));
52
53
//connect slots
54
connect(
m_widget
.get(), SIGNAL(itemChanged()),
this
, SLOT(
onItemChanged
()));
55
}
56
57
te::qt::widgets::FieldsWizardPage::~FieldsWizardPage
()
58
{
59
}
60
61
bool
te::qt::widgets::FieldsWizardPage::isComplete
()
const
62
{
63
if
(m_widget->getOutputValues().empty())
64
return
false
;
65
66
return
true
;
67
}
68
69
te::qt::widgets::DoubleListWidget
*
te::qt::widgets::FieldsWizardPage::getWidget
()
const
70
{
71
return
m_widget.get();
72
}
73
74
te::da::Fields
*
te::qt::widgets::FieldsWizardPage::getFields
()
75
{
76
te::da::Fields
* fields =
new
te::da::Fields
;
77
78
std::vector<std::string> values = m_widget->getOutputValues();
79
80
for
(
size_t
t = 0; t < values.size(); ++t)
81
{
82
te::da::Field
* f =
new
te::da::Field
(
new
te::da::PropertyName
(values[t]));
83
84
fields->push_back(f);
85
}
86
87
return
fields;
88
}
89
90
void
te::qt::widgets::FieldsWizardPage::setFields
(
const
te::da::Fields
* fields)
91
{
92
std::vector<std::string> values;
93
94
for
(std::size_t i = 0; i < fields->size(); ++i)
95
{
96
te::da::Field
f = fields->at(i);
97
98
te::da::PropertyName
* p =
dynamic_cast<
te::da::PropertyName
*
>
(f.
getExpression
());
99
100
values.push_back(p->
getName
());
101
}
102
103
m_widget->setOutputValues(values);
104
}
105
106
void
te::qt::widgets::FieldsWizardPage::onItemChanged
()
107
{
108
emit completeChanged();
109
}
te::da::PropertyName::getName
const std::string & getName() const
It returns the property name.
Definition:
PropertyName.h:80
te::da::Field
The Field class can be used to model an expression that takes part of the output items of a SELECT...
Definition:
Field.h:50
te::qt::widgets::FieldsWizardPage::getWidget
DoubleListWidget * getWidget() const
Definition:
FieldsWizardPage.cpp:69
te::qt::widgets::FieldsWizardPage::m_widget
std::auto_ptr< DoubleListWidget > m_widget
Definition:
FieldsWizardPage.h:78
te::qt::widgets::DoubleListWidget
...
Definition:
DoubleListWidget.h:53
te::qt::widgets::FieldsWizardPage::isComplete
bool isComplete() const
Definition:
FieldsWizardPage.cpp:61
te::da::PropertyName
A class that models the name of any property of an object.
Definition:
PropertyName.h:50
te::da::Field::getExpression
Expression * getExpression() const
It returns the expression set for an output select query.
Definition:
Field.cpp:80
FieldsWizardPage.h
This file has the FieldsWizardPage class.
te::qt::widgets::FieldsWizardPage::getFields
te::da::Fields * getFields()
Definition:
FieldsWizardPage.cpp:74
te::qt::widgets::FieldsWizardPage::onItemChanged
void onItemChanged()
Definition:
FieldsWizardPage.cpp:106
te::da::Fields
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
Definition:
Fields.h:37
te::qt::widgets::FieldsWizardPage::FieldsWizardPage
FieldsWizardPage(QWidget *parent=0)
Definition:
FieldsWizardPage.cpp:37
te::qt::widgets::FieldsWizardPage::setFields
void setFields(const te::da::Fields *fields)
Definition:
FieldsWizardPage.cpp:90
te::qt::widgets::FieldsWizardPage::~FieldsWizardPage
virtual ~FieldsWizardPage()
Definition:
FieldsWizardPage.cpp:57
git_master
terralib5
src
terralib
qt
widgets
query
FieldsWizardPage.cpp
Generated on Tue Jan 12 2016 08:40:58 for TerraLib by
1.8.9.1