All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HorizontalSliderWidget.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 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/HorizontalSliderWidget.cpp
22 
23  \brief ...
24 */
25 
26 // TerraLib
27 #include "../../../common/Translator.h"
28 #include "ui_HorizontalSliderWidgetForm.h"
29 #include "HorizontalSliderWidget.h"
30 
31 // Qt
32 #include <QtGui/QPushButton>
33 
34 
35 
37  : QWidget(parent, f),
38  m_ui(new Ui::HorizontalSliderWidgetForm)
39 {
40  m_ui->setupUi(this);
41 
42 // default values
43  m_minValue = 0;
44  m_maxValue = 99;
45  m_defaultValue = 0;
46 
47 // connect signals and slots
48  connect(m_ui->m_defaultPushButton, SIGNAL(released()), this, SLOT(onDefaultButtonPressed()));
49  connect(m_ui->m_slider, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
50  connect(m_ui->m_slider, SIGNAL(sliderReleased()), this, SLOT(onSliderReleased()));
51 }
52 
54 {
55 }
56 
57 Ui::HorizontalSliderWidgetForm* te::qt::widgets::HorizontalSliderWidget::getForm() const
58 {
59  return m_ui.get();
60 }
61 
63 {
64  m_ui->m_groupBox->setTitle(value);
65 }
66 
68 {
69  m_minValue = min;
70  m_ui->m_slider->setMinimum(m_minValue);
71 
72  m_maxValue = max;
73  m_ui->m_slider->setMaximum(m_maxValue);
74 }
75 
77 {
78  m_defaultValue = value;
79 
80  m_ui->m_sliderLabel->setNum(m_defaultValue);
81 
82  m_ui->m_slider->setValue(m_defaultValue);
83 }
84 
86 {
87  m_ui->m_sliderLabel->setNum(value);
88 
89  m_ui->m_slider->setValue(value);
90 }
91 
93 {
94  return m_ui->m_slider->value();
95 }
96 
98 {
99  m_ui->m_defaultPushButton->setVisible(visible);
100 }
101 
103 {
104  m_ui->m_sliderLabel->setVisible(visible);
105 }
106 
108 {
109  m_ui->m_slider->setValue(m_defaultValue);
110 
111  onValueChanged(m_defaultValue);
112 
113  onSliderReleased();
114 }
115 
117 {
118  m_ui->m_sliderLabel->setNum(value);
119 
120  emit sliderValueChanged(value);
121 }
122 
124 {
125  emit sliderReleased();
126 }
int m_defaultValue
Slider default value (default 0)
HorizontalSliderWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Ui::HorizontalSliderWidgetForm * getForm() const
int m_minValue
Slider Minimum value (default 0)
int m_maxValue
Slider Maximum value (default 99)
std::auto_ptr< Ui::HorizontalSliderWidgetForm > m_ui