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) 2001-2014 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
24 
25  \ingroup layout
26 */
27 
28 #ifndef __TERRALIB_LAYOUT_INTERNAL_PROPERTY_BROWSER_H
29 #define __TERRALIB_LAYOUT_INTERNAL_PROPERTY_BROWSER_H
30 
31 // TerraLib
32 #include "Property.h"
33 
34 // Qt
35 #include <QObject>
36 #include "../../../../../../third-party/qt/propertybrowser/qttreepropertybrowser.h"
37 #include "../../../../../../third-party/qt/propertybrowser/qtpropertybrowser.h"
38 #include "../../../../../../third-party/qt/propertybrowser/qtpropertymanager.h"
39 #include <QList>
40 
41 class QGraphicsItem;
42 class QWidget;
43 
44 class QtVariantProperty;
45 class QtProperty;
46 class QtVariantPropertyManager;
47 class QtBrowserIndex;
48 
49 namespace te
50 {
51  namespace layout
52  {
53  class Properties;
54 
55  class PropertyBrowser : public QObject
56  {
57  Q_OBJECT //for slots/signals
58 
59  public:
60 
61  PropertyBrowser(QObject *parent = 0);
62  virtual ~PropertyBrowser();
63 
64  QtTreePropertyBrowser* getPropertyEditor();
65  QtVariantPropertyManager* getVariantPropertyManager();
66 
67  virtual void clearAll();
68 
69  virtual bool addProperty(Property property);
70 
71  virtual bool removeProperty(Property property);
72 
73  virtual Property getProperty(std::string name);
74 
75  virtual Properties* getProperties();
76 
77  virtual LayoutPropertyDataType getLayoutType(QVariant::Type type, std::string name = "");
78 
79  virtual QVariant::Type getVariantType(LayoutPropertyDataType dataType);
80 
81  virtual std::string getPropGridSettingsName();
82 
83  virtual void setHasGridWindows(bool hasWindows = false);
84 
85  private slots:
86 
87  void propertyEditorValueChanged(QtProperty *property, const QVariant &value);
88  void onChangeFilter(const QString& filter);
89  virtual void onSetDlg(QWidget *parent, QtProperty * prop) = 0;
90 
91  signals:
92 
93  void changePropertyValue(QtProperty *property, QList<QtBrowserItem*> items);
94  void changePropertyValue(Property property);
95 
96  protected:
97 
98  virtual void addPropertyItem(QtProperty *property, const QString &id);
99  virtual void updateExpandState();
100  virtual void createManager();
101  virtual void changeVisibility( QList<QtBrowserItem*> items, bool visible );
102  virtual QVariant findPropertyValue(std::string name);
103  virtual QtProperty* findProperty(std::string name);
104  virtual void blockOpenGridWindows(bool block);
105  virtual void addAttribute(QtVariantProperty* vproperty, Property property);
106  virtual QVariant checkComplexType(QtVariantProperty* property);
107 
108  protected:
109 
110  QtTreePropertyBrowser* m_propertyEditor;
111  QtVariantPropertyManager* m_variantPropertyEditorManager;
112  QtStringPropertyManager* m_strDlgManager;
113  QMap<QtProperty*, QString> m_propertyToId;
114  QMap<QString, QtProperty*> m_idToProperty;
115  QMap<QString, bool> m_idToExpanded;
116 
117  /* Custom Types: Dialog Window Type */
120  };
121  }
122 }
123 
124 #endif
virtual void addAttribute(QtVariantProperty *vproperty, Property property)
virtual QVariant::Type getVariantType(LayoutPropertyDataType dataType)
virtual std::string getPropGridSettingsName()
virtual LayoutPropertyDataType getLayoutType(QVariant::Type type, std::string name="")
QtVariantPropertyManager * m_variantPropertyEditorManager
virtual QVariant findPropertyValue(std::string name)
virtual void onSetDlg(QWidget *parent, QtProperty *prop)=0
QtTreePropertyBrowser * getPropertyEditor()
QtVariantPropertyManager * getVariantPropertyManager()
virtual void blockOpenGridWindows(bool block)
QMap< QString, QtProperty * > m_idToProperty
virtual QtProperty * findProperty(std::string name)
void changePropertyValue(QtProperty *property, QList< QtBrowserItem * > items)
QMap< QtProperty *, QString > m_propertyToId
void onChangeFilter(const QString &filter)
virtual Properties * getProperties()
QtTreePropertyBrowser * m_propertyEditor
QMap< QString, bool > m_idToExpanded
virtual bool removeProperty(Property property)
virtual bool addProperty(Property property)
virtual void changeVisibility(QList< QtBrowserItem * > items, bool visible)
virtual QVariant checkComplexType(QtVariantProperty *property)
virtual void addPropertyItem(QtProperty *property, const QString &id)
virtual Property getProperty(std::string name)
PropertyBrowser(QObject *parent=0)
virtual void setHasGridWindows(bool hasWindows=false)
void propertyEditorValueChanged(QtProperty *property, const QVariant &value)
LayoutPropertyDataType
Enum LayoutPropertyDataType.
Definition: AbstractType.h:131
QtStringPropertyManager * m_strDlgManager