GammaRay  2.3.0
propertywidget.h
1 /*
2  propertywidget.h
3 
4  This file is part of GammaRay, the Qt application inspection and
5  manipulation tool.
6 
7  Copyright (C) 2010-2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
8  Author: Volker Krause <volker.krause@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 GAMMARAY_PROPERTYWIDGET_H
30 #define GAMMARAY_PROPERTYWIDGET_H
31 
32 #include <QTabWidget>
33 #include <QPointer>
34 #include <QHash>
35 
36 #include "gammaray_ui_export.h"
37 #include <common/enums.h>
38 #include "propertywidgettab.h"
39 
40 class QAbstractItemModel;
41 class QAbstractItemView;
42 class QModelIndex;
43 
44 namespace GammaRay {
45 
46 class Ui_PropertyWidget;
47 class PropertyControllerInterface;
48 
50 class GAMMARAY_UI_EXPORT PropertyWidget : public QTabWidget
51 {
52  Q_OBJECT
53  public:
54  explicit PropertyWidget(QWidget *parent = 0);
55  virtual ~PropertyWidget();
56 
57  QString objectBaseName() const;
58  void setObjectBaseName(const QString &baseName);
59 
60  template<typename T> static void registerTab(QString name, QString label)
61  {
62  s_tabFactories << new PropertyWidgetTabFactory<T>(name, label);
63  foreach (PropertyWidget *widget, s_propertyWidgets)
64  widget->createWidgets();
65  }
66 
67  private:
68  void createWidgets();
69  bool extensionAvailable(PropertyWidgetTabFactoryBase *factory) const;
70 
71  private slots:
72  void updateShownTabs();
73 
74 
75  private:
76  QString m_objectBaseName;
77 
78  // Contains all tab widgets we have instantiated and their corresponding factories
79  // order matters, therefore these are two vectors rather than a hash or map
80  QVector<PropertyWidgetTabFactoryBase*> m_usedFactories;
81  QVector<QWidget*> m_tabWidgets;
82 
83  PropertyControllerInterface *m_controller;
84 
85  static QVector<PropertyWidgetTabFactoryBase*> s_tabFactories;
86  static QVector<PropertyWidget*> s_propertyWidgets;
87 };
88 
89 }
90 
91 #endif // GAMMARAY_PROPERTYWIDGET_H
Client/Server interface of the property editor.
Definition: propertycontrollerinterface.h:40
Interface for tabs in the property widget.
Definition: propertywidgettab.h:40
Definition: endpoint.h:41
Client-side counter-part GammaRay::PropertyController.
Definition: propertywidget.h:50

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/