All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PropertyBrowser.h
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 PropertyBrowser.h
22 
23  \brief Manage properties variants values. Maps the QProperty properties (Qt) and Property (Layout) and add to a tree (QtTreePropertyBrowser) for presentation to the user,
24  allowing the modification and interactive update.
25 
26  \ingroup layout
27 */
28 
29 #ifndef __TERRALIB_LAYOUT_INTERNAL_PROPERTY_BROWSER_H
30 #define __TERRALIB_LAYOUT_INTERNAL_PROPERTY_BROWSER_H
31 
32 // TerraLib
33 #include "../../../core/property/Property.h"
34 #include "../../../core/Config.h"
35 
36 // Qt
37 #include <QObject>
38 
39 // QtPropertyBrowser
40 #include <QtPropertyBrowser/QtTreePropertyBrowser>
41 #include <QtPropertyBrowser/QtStringPropertyManager>
42 #include <QtPropertyBrowser/QtProperty>
43 #include <QtPropertyBrowser/QtVariantPropertyManager>
44 #include <QtPropertyBrowser/QtBrowserItem>
45 
46 class QGraphicsItem;
47 class QWidget;
48 
49 namespace te
50 {
51  namespace layout
52  {
53  class Properties;
54  class EnumType;
55  class VariantPropertiesBrowser;
56  class DialogPropertiesBrowser;
57 
58  /*!
59  \brief Manage properties variants values. Maps the QProperty properties (Qt) and Property (Layout) and add to a tree (QtTreePropertyBrowser) for presentation to the user,
60  allowing the modification and interactive update.
61 
62  \ingroup layout
63  */
64  class TELAYOUTEXPORT PropertyBrowser : public QObject
65  {
66  Q_OBJECT //for slots/signals
67 
68  public:
69 
70  PropertyBrowser(QObject *parent = 0);
71 
72  virtual ~PropertyBrowser();
73 
74  QtTreePropertyBrowser* getPropertyEditor();
75 
76  VariantPropertiesBrowser* getVariantPropertiesBrowser();
77 
78  DialogPropertiesBrowser* getDialogPropertiesBrowser();
79 
80  virtual void clearAll();
81 
82  virtual void closeAllWindows();
83 
84  virtual QtProperty* addProperty(Property property);
85 
86  virtual bool removeProperty(Property property);
87 
88  virtual bool updateProperty(Property property);
89 
90  virtual void updateProperties(Properties* props);
91 
92  virtual Properties* getProperties();
93 
94  virtual void setHasWindows(bool hasWindows = false);
95 
96  virtual void selectProperty(std::string name);
97 
98  virtual QtProperty* findProperty(std::string name);
99 
100  virtual bool addSubProperty(QtProperty* prop, QtProperty* subProp);
101 
102  virtual bool addSubProperty(Property prop, Property subProp);
103 
104  private slots:
105 
106  void propertyEditorValueChanged(QtProperty *property, const QVariant &value);
107 
108  void onChangeFilter(const QString& filter);
109 
110  virtual void onChangeDlgProperty(Property property);
111 
112  signals:
113 
114  void changePropertyValue(QtProperty *property, QList<QtBrowserItem*> items);
115 
116  void changePropertyValue(Property property);
117 
118  protected:
119 
120  virtual void addPropertyItem(QtProperty *property, const QString &id);
121 
122  virtual void updateExpandState();
123 
124  virtual void createManager();
125 
126  virtual void changeVisibility( QList<QtBrowserItem*> items, bool visible );
127 
128  virtual void blockOpenWindows(bool block);
129 
130  protected:
131 
132  QtTreePropertyBrowser* m_propertyEditor;
135  QMap<QtProperty*, QString> m_propertyToId;
136  QMap<QString, QtProperty*> m_idToProperty;
137  QMap<QString, bool> m_idToExpanded;
138 
139 
140  /* Custom Types: Dialog Window Type */
142  bool m_changeQtPropertyVariantValue; // true if the change of QtPropertyVariant came from a Property and not of user interaction via Property Browser
143  };
144  }
145 }
146 
147 #endif
148 
149 
Manage properties variants values.
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
Definition: Properties.h:52
QMap< QString, QtProperty * > m_idToProperty
QMap< QtProperty *, QString > m_propertyToId
Manage properties variants values. Maps the QProperty properties (Qt) and Property (Layout) and add t...
VariantPropertiesBrowser * m_variantPropertiesBrowser
QtTreePropertyBrowser * m_propertyEditor
QMap< QString, bool > m_idToExpanded
DialogPropertiesBrowser * m_dialogPropertiesBrowser
Manage properties dialogs values.
A property acts like a attribute member of a object and stores the state of this attribute. A set of properties stores the state of an object. Any data type, not included in the convertValue method in the class te::layout::Variant, it will be by default "std::string" value.
Definition: Property.h:47