ParameterDialog.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/utils/ParameterDialog.cpp
22 
23  \brief A dialog to be used as input of key/value pairs.
24 */
25 
26 // TerraLib
27 #include "ui_ParameterDialogForm.h"
28 #include "ParameterDialog.h"
29 
30 
32  : QDialog(parent, f),
33  m_ui(new Ui::ParameterDialogForm)
34 {
35  m_ui->setupUi(this);
36 
37  connect(m_ui->m_paramNameLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(onParamNameTextEdited(const QString&)));
38  connect(m_ui->m_paramValueLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(onParamValueTextEdited(const QString&)));
39 }
40 
42 
44 {
45  return m_ui->m_paramNameLineEdit->text().trimmed();
46 }
47 
49 {
50  m_pname = name;
51  m_ui->m_paramNameLineEdit->setText(name);
52 }
53 
55 {
56  return m_ui->m_paramValueLineEdit->text().trimmed();
57 }
58 
60 {
61  m_pvalue = value;
62  m_ui->m_paramValueLineEdit->setText(value);
63 }
64 
66 {
67  if(nextTxt != m_pname)
68  m_ui->m_okPushButton->setEnabled(true);
69  else if(m_pvalue == m_ui->m_paramValueLineEdit->text())
70  m_ui->m_okPushButton->setEnabled(false);
71 }
72 
74 {
75  if(nextTxt != m_pvalue)
76  m_ui->m_okPushButton->setEnabled(true);
77  else if(m_pname == m_ui->m_paramNameLineEdit->text())
78  m_ui->m_okPushButton->setEnabled(false);
79 }
80 
void onParamValueTextEdited(const QString &nextTxt)
std::unique_ptr< Ui::ParameterDialogForm > m_ui
ParameterDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void onParamNameTextEdited(const QString &nextTxt)
void setValue(const QString &value)
void setName(const QString &name)
A dialog to be used as input of key/value pairs.