AbstractPropertyItem.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/se/AbstractPropertyItem.cpp
22 
23  \brief A widget used to define the main property items
24  that can be used to describe a se object.
25 */
26 
27 #include "AbstractPropertyItem.h"
28 
30 
31 
32 
33 te::qt::widgets::AbstractPropertyItem::AbstractPropertyItem(QtTreePropertyBrowser* pb, QColor c) :
34  m_propertyBrowser(pb), m_colorParent(c)
35 {
37 
38  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_intManager, SIGNAL(valueChanged(QtProperty *, int)), this, SLOT(valueChanged(QtProperty *, int)));
39  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_intSliderManager, SIGNAL(valueChanged(QtProperty *, int)), this, SLOT(valueChanged(QtProperty *, int)));
40  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_doubleManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(valueChanged(QtProperty *, double)));
41  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_boolManager, SIGNAL(valueChanged(QtProperty *, bool)), this, SLOT(valueChanged(QtProperty *, bool)));
42  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_stringManager, SIGNAL(valueChanged(QtProperty *, const QString &)), this, SLOT(valueChanged(QtProperty *, const QString &)));
43  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_colorManager, SIGNAL(valueChanged(QtProperty *, const QColor &)), this, SLOT(valueChanged(QtProperty *, const QColor &)));
44  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_fontManager, SIGNAL(valueChanged(QtProperty *, const QFont &)), this, SLOT(valueChanged(QtProperty *, const QFont &)));
45  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_sizeManager, SIGNAL(valueChanged(QtProperty *, const QSize &)), this, SLOT(valueChanged(QtProperty *, const QSize &)));
46  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_sizeFManager, SIGNAL(valueChanged(QtProperty *, const QSizeF &)), this, SLOT(valueChanged(QtProperty *, const QSizeF &)));
47  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_enumManager, SIGNAL(valueChanged(QtProperty *, int)), this, SLOT(valueChanged(QtProperty *, int)));
48  connect(te::qt::widgets::AbstractPropertyManager::getInstance().m_pointFManager, SIGNAL(valueChanged(QtProperty *, const QPointF &)), this, SLOT(valueChanged(QtProperty *, const QPointF &)));
49 }
50 
52 
53 void te::qt::widgets::AbstractPropertyItem::addProperty(QtProperty* p, const QString &id, QColor c)
54 {
55  m_propertyToId[p] = id;
56  m_idToProperty[id] = p;
57  QtBrowserItem* item = m_propertyBrowser->addProperty(p);
58 
59  if(m_colorParent.isValid())
60  m_propertyBrowser->setBackgroundColor(item, m_colorParent);
61  else
62  m_propertyBrowser->setBackgroundColor(item, c);
63 
64  m_propertyBrowser->setExpanded(item, true);
65 
66  setExpandedStatus(item, false);
67 
68 }
69 
71  QtBrowserItem *item, bool /*status*/)
72 {
73  QList<QtBrowserItem*> list = item->children();
74 
75  for(int i = 0; i < list.size(); ++i)
76  {
77  m_propertyBrowser->setExpanded(list[i], false);
78 
79  setExpandedStatus(list[i], false);
80  }
81 }
82 
84  int /*value*/)
85 {
86 }
87 
89  double /*value*/)
90 {
91 }
92 
94  bool /*value*/)
95 {
96 }
97 
99  QtProperty * /*p*/, const QString & /*value*/)
100 {
101 }
102 
104  QtProperty * /*p*/, const QColor & /*value*/)
105 {
106 }
107 
109  QtProperty * /*p*/, const QFont & /*value*/)
110 {
111 }
112 
114  QtProperty * /*p*/, const QSize & /*value*/)
115 {
116 }
117 
119  QtProperty * /*p*/, const QSizeF & /*value*/)
120 {
121 }
122 
124  QtProperty * /*p*/, const QPointF & /*value*/)
125 {
126 }
virtual void valueChanged(QtProperty *p, int value)
void setExpandedStatus(QtBrowserItem *item, bool status)
static AbstractPropertyManager & getInstance()
It returns a reference to the singleton instance.
QMap< QString, QtProperty * > m_idToProperty
te::gm::Polygon * p
AbstractPropertyItem(QtTreePropertyBrowser *pb, QColor c=QColor())
Constructor.
void addProperty(QtProperty *property, const QString &id, QColor c)
QMap< QtProperty *, QString > m_propertyToId