Computer Assited Medical Intervention Tool Kit  version 4.0
qtvariantproperty.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 **
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 **
8 ** This file is part of a Qt Solutions component.
9 **
10 ** You may use this file under the terms of the BSD license as follows:
11 **
12 ** "Redistribution and use in source and binary forms, with or without
13 ** modification, are permitted provided that the following conditions are
14 ** met:
15 ** * Redistributions of source code must retain the above copyright
16 ** notice, this list of conditions and the following disclaimer.
17 ** * Redistributions in binary form must reproduce the above copyright
18 ** notice, this list of conditions and the following disclaimer in
19 ** the documentation and/or other materials provided with the
20 ** distribution.
21 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22 ** the names of its contributors may be used to endorse or promote
23 ** products derived from this software without specific prior written
24 ** permission.
25 **
26 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37 **
38 ****************************************************************************/
39 
40 
41 #ifndef QTVARIANTPROPERTY_H
42 #define QTVARIANTPROPERTY_H
43 
44 #include "qtpropertybrowser.h"
45 #include <QtCore/QVariant>
46 #include <QtGui/QIcon>
47 
48 #if QT_VERSION >= 0x040400
49 QT_BEGIN_NAMESPACE
50 #endif
51 
52 typedef QMap<int, QIcon> QtIconMap;
53 
56 
65 public:
67  QVariant value() const;
68  QVariant attributeValue(const QString &attribute) const;
69  int valueType() const;
70  int propertyType() const;
71 
72  void setValue(const QVariant &value);
73  void setAttribute(const QString &attribute, const QVariant &value);
74 protected:
76 private:
79 };
80 
82 
84  Q_OBJECT
85 public:
86  QtVariantPropertyManager(QObject *parent = 0);
88 
89  virtual QtVariantProperty *addProperty(int propertyType, const QString &name = QString());
90 
91  int propertyType(const QtProperty *property) const;
92  int valueType(const QtProperty *property) const;
93  QtVariantProperty *variantProperty(const QtProperty *property) const;
94 
95  virtual bool isPropertyTypeSupported(int propertyType) const;
96  virtual int valueType(int propertyType) const;
97  virtual QStringList attributes(int propertyType) const;
98  virtual int attributeType(int propertyType, const QString &attribute) const;
99 
100  virtual QVariant value(const QtProperty *property) const;
101  virtual QVariant attributeValue(const QtProperty *property, const QString &attribute) const;
102 
103  static int enumTypeId();
104  static int flagTypeId();
105  static int groupTypeId();
106  static int iconMapTypeId();
107 public Q_SLOTS:
108  virtual void setValue(QtProperty *property, const QVariant &val);
109  virtual void setAttribute(QtProperty *property,
110  const QString &attribute, const QVariant &value);
111 Q_SIGNALS:
112  void valueChanged(QtProperty *property, const QVariant &val);
113  void attributeChanged(QtProperty *property,
114  const QString &attribute, const QVariant &val);
115 protected:
116  virtual bool hasValue(const QtProperty *property) const;
117  QString valueText(const QtProperty *property) const;
118  QIcon valueIcon(const QtProperty *property) const;
119  virtual void initializeProperty(QtProperty *property);
120  virtual void uninitializeProperty(QtProperty *property);
121  virtual QtProperty *createProperty();
122 private:
124  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, int))
125  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int))
126  Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, int))
127  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, double))
128  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, double, double))
129  Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, double))
130  Q_PRIVATE_SLOT(d_func(), void slotDecimalsChanged(QtProperty *, int))
131  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, bool))
132  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QString &))
133  Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegExp &))
134  Q_PRIVATE_SLOT(d_func(), void slotEchoModeChanged(QtProperty *, int))
135  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDate &))
136  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QDate &, const QDate &))
137  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QTime &))
138  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDateTime &))
139  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QKeySequence &))
140  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QChar &))
141  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QLocale &))
142  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QPoint &))
143  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QPointF &))
144  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QVector3D &))
145  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSize &))
146  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QSize &, const QSize &))
147  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSizeF &))
148  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QSizeF &, const QSizeF &))
149  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QRect &))
150  Q_PRIVATE_SLOT(d_func(), void slotConstraintChanged(QtProperty *, const QRect &))
151  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QRectF &))
152  Q_PRIVATE_SLOT(d_func(), void slotConstraintChanged(QtProperty *, const QRectF &))
153  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QColor &))
154  Q_PRIVATE_SLOT(d_func(), void slotEnumNamesChanged(QtProperty *, const QStringList &))
155  Q_PRIVATE_SLOT(d_func(), void slotEnumIconsChanged(QtProperty *, const QMap<int, QIcon> &))
156  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSizePolicy &))
157  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QFont &))
158  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QCursor &))
159  Q_PRIVATE_SLOT(d_func(), void slotFlagNamesChanged(QtProperty *, const QStringList &))
160 
161  Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))
162  Q_PRIVATE_SLOT(d_func(), void slotPropertyRemoved(QtProperty *, QtProperty *))
163  Q_DECLARE_PRIVATE(QtVariantPropertyManager)
164  Q_DISABLE_COPY(QtVariantPropertyManager)
165 };
166 
168 
170  Q_OBJECT
171 public:
172  QtVariantEditorFactory(QObject *parent = 0);
174 protected:
176  QWidget *createEditor(QtVariantPropertyManager *manager, QtProperty *property,
177  QWidget *parent);
179 private:
181  Q_DECLARE_PRIVATE(QtVariantEditorFactory)
182  Q_DISABLE_COPY(QtVariantEditorFactory)
183 };
184 
185 #if QT_VERSION >= 0x040400
186 QT_END_NAMESPACE
187 #endif
188 
189 Q_DECLARE_METATYPE(QIcon)
190 Q_DECLARE_METATYPE(QtIconMap)
191 #endif
virtual QtProperty * createProperty()
Definition: qtpropertybrowser.cpp:754
QtVariantPropertyPrivate * d_ptr
Definition: qtvariantproperty.h:78
The QtVariantPropertyManager class provides and manages QVariant based properties.
Definition: qtvariantproperty.h:83
The QtAbstractPropertyManager provides an interface for property managers.
Definition: qtpropertybrowser.h:114
The QtAbstractEditorFactory is the base template class for editor factories.
Definition: qtpropertybrowser.h:164
QtProperty * addProperty(const QString &name=QString())
Definition: qtpropertybrowser.cpp:735
virtual void initializeProperty(QtProperty *property)=0
Definition: qtvariantproperty.cpp:280
virtual void uninitializeProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:786
virtual bool hasValue(const QtProperty *property) const
Definition: qtpropertybrowser.cpp:667
QtVariantEditorFactoryPrivate * d_ptr
Definition: qtvariantproperty.h:180
QMap< int, QIcon > QtIconMap
Definition: qtvariantproperty.h:52
Definition: qtvariantproperty.cpp:1824
Definition: qtvariantproperty.cpp:139
#define QT_QTPROPERTYBROWSER_EXPORT
Definition: qtpropertybrowser.h:59
QtVariantPropertyManagerPrivate * d_ptr
Definition: qtvariantproperty.h:123
The description of this class will come soon !
Definition: qtvariantproperty.h:64
virtual QString valueText(const QtProperty *property) const
Definition: qtpropertybrowser.cpp:695
QWidget * createEditor(QtProperty *property, QWidget *parent)
Definition: qtpropertybrowser.h:167
The description of this class will come soon !
Definition: qtpropertybrowser.h:74
virtual void disconnectPropertyManager(PropertyManager *manager)=0
The QtVariantEditorFactory class provides widgets for properties created by QtVariantPropertyManager ...
Definition: qtvariantproperty.h:169
virtual void connectPropertyManager(PropertyManager *manager)=0
virtual QIcon valueIcon(const QtProperty *property) const
Definition: qtpropertybrowser.cpp:681