All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
NumericPropertyWidget.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/property/NumericPropertyWidget.h
22 
23  \brief Defines the NumericPropertyWidget class.
24 */
25 
26 // Terralib
27 #include "../../../datatype/NumericProperty.h"
28 #include "NumericPropertyWidget.h"
29 #include "ui_NumericPropertyWidgetForm.h"
30 
31 
33  : SimplePropertyWidget(parent),
34  m_ui(new Ui::NumericPropertyWidgetForm)
35 {
36  m_ui->setupUi(this);
37 
38 }
39 
41 {
42 
43 }
44 
46 {
47  te::dt::NumericProperty* np = dynamic_cast<te::dt::NumericProperty*>(sp);
48 
49  if(np)
50  {
51  if(m_ui->m_scaleLineEdit->text().isEmpty() == false)
52  {
53  bool ok = false;
54  unsigned int scale = m_ui->m_scaleLineEdit->text().toUInt(&ok);
55 
56  if(ok)
57  np->setScale(scale);
58  }
59 
60  if(m_ui->m_precisionLineEdit->text().isEmpty() == false)
61  {
62  bool ok = false;
63  unsigned int precision = m_ui->m_precisionLineEdit->text().toUInt(&ok);
64 
65  if(ok)
66  np->setPrecision(precision);
67  }
68  }
69 }
A base widget for simple properties.
An atomic property like an integer or double.
void setScale(unsigned int scale)
Sets the count of decimal digits in the fractional part, to the right of the decimal point...
The type for arbitrary precison numbers, like numeric(p, q).
std::auto_ptr< Ui::NumericPropertyWidgetForm > m_ui
virtual void fillProperty(te::dt::SimpleProperty *sp)
Defines the NumericPropertyWidget class.
void setPrecision(unsigned int precision)
Sets the total count of significant digits in the whole number, that is, the number of digits to both...