GammaRay  2.3.0
propertycontrollerextension.h
1 /*
2  propertycontrollerextension.h
3 
4  This file is part of GammaRay, the Qt application inspection and
5  manipulation tool.
6 
7  Copyright (C) 2014-2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
8  Author: Anton Kreuzkamp <anton.kreuzkamp@kdab.com>
9 
10  Licensees holding valid commercial KDAB GammaRay licenses may use this file in
11  accordance with GammaRay Commercial License Agreement provided with the Software.
12 
13  Contact info@kdab.com if any conditions of this licensing are not clear to you.
14 
15  This program is free software; you can redistribute it and/or modify
16  it under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 2 of the License, or
18  (at your option) any later version.
19 
20  This program is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  GNU General Public License for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with this program. If not, see <http://www.gnu.org/licenses/>.
27 */
28 
29 #ifndef PROPERTYCONTROLLEREXTENSION_H
30 #define PROPERTYCONTROLLEREXTENSION_H
31 
32 #include "gammaray_core_export.h"
33 
34 #include <QString>
35 
36 class QObject;
37 struct QMetaObject;
38 
39 namespace GammaRay {
40 
41 class PropertyController;
42 
53 class GAMMARAY_CORE_EXPORT PropertyControllerExtension
54 {
55 public:
59  explicit PropertyControllerExtension(const QString &name);
60  virtual ~PropertyControllerExtension();
61 
66  virtual bool setObject(void *object, const QString &typeName);
67 
72  virtual bool setQObject(QObject *object);
73 
78  virtual bool setMetaObject(const QMetaObject *metaObject);
79 
81  QString name() const;
82 
83 private:
84  QString m_name;
85 };
86 
88 class PropertyControllerExtensionFactoryBase {
89  public:
90  explicit PropertyControllerExtensionFactoryBase() {}
91  virtual PropertyControllerExtension *create(PropertyController *controller) = 0;
92 };
93 
94 template <typename T>
95 class PropertyControllerExtensionFactory : public PropertyControllerExtensionFactoryBase
96 {
97  public:
98  static PropertyControllerExtensionFactoryBase* instance()
99  {
100  if (!s_instance)
101  s_instance = new PropertyControllerExtensionFactory<T>();
102  return s_instance;
103  }
104 
105  PropertyControllerExtension *create(PropertyController *controller)
106  {
107  return new T(controller);
108  }
109 
110  private:
111  explicit PropertyControllerExtensionFactory() {}
112  static PropertyControllerExtensionFactory<T>* s_instance;
113 };
114 
115 template <typename T>
116 PropertyControllerExtensionFactory<T>* PropertyControllerExtensionFactory<T>::s_instance = 0;
118 
119 }
120 
121 #endif // PROPERTYCONTROLLEREXTENSION_H
Base-class for server-side property editor extensions.
Definition: propertycontrollerextension.h:53
Definition: endpoint.h:41
full QObject instance
Definition: enums.h:39

Klarälvdalens Datakonsult AB (KDAB)
"The Qt Experts"
http://www.kdab.com/
GammaRay
Qt-application inspection and manipulation tool
http://www.kdab.com/kdab-products/gammaray/