All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DateTimePropertyWidget.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2013 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/property/DateTimePropertyWidget.h
22 
23  \brief Defines the DateTimePropertyWidget class.
24 */
25 
26 // Terralib
27 #include "../../../datatype/DateTimeProperty.h"
28 #include "../../../datatype/Enums.h"
29 #include "DateTimePropertyWidget.h"
30 #include "ui_DateTimePropertyWidgetForm.h"
31 
32 
34  : SimplePropertyWidget(parent),
35  m_ui(new Ui::DateTimePropertyWidgetForm)
36 {
37  m_ui->setupUi(this);
38 
39  //fill combo box
40  m_ui->m_typeComboBox->addItem(tr("Date"), te::dt::DATE);
41  m_ui->m_typeComboBox->addItem(tr("Date Period"), te::dt::DATE_PERIOD);
42  m_ui->m_typeComboBox->addItem(tr("Date Durantion"), te::dt::DATE_DURATION);
43  m_ui->m_typeComboBox->addItem(tr("Time Duration"), te::dt::TIME_DURATION);
44  m_ui->m_typeComboBox->addItem(tr("Time Instante"), te::dt::TIME_INSTANT);
45  m_ui->m_typeComboBox->addItem(tr("Time Period"), te::dt::TIME_PERIOD);
46  m_ui->m_typeComboBox->addItem(tr("Time Instante wih Zone"), te::dt::TIME_INSTANT_TZ);
47  m_ui->m_typeComboBox->addItem(tr("Time Period with Zone"), te::dt::TIME_PERIOD_TZ);
48 }
49 
51 {
52 
53 }
54 
56 {
57  int index = m_ui->m_typeComboBox->currentIndex();
58  int dateTimeType = m_ui->m_typeComboBox->itemData(index).toInt();
59 
60  te::dt::DateTimeProperty* dtp = dynamic_cast<te::dt::DateTimeProperty*>(sp);
61 
62  if(dtp)
63  {
64  dtp->setSubtype((te::dt::DateTimeType)dateTimeType);
65  }
66 }
std::auto_ptr< Ui::DateTimePropertyWidgetForm > m_ui
An atomic property like an integer or double.
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
virtual void fillProperty(te::dt::SimpleProperty *sp)
DateTimeType
The subtype of date and time type.
Definition: Enums.h:38
A base widget for simple properties.
Defines the DateTimePropertyWidget class.
void setSubtype(DateTimeType t)
It sets the date time property sub type.