Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
55 class QtVariantPropertyPrivate;
56 
65 {
66 public:
68  QVariant value() const;
69  QVariant attributeValue(const QString &attribute) const;
70  int valueType() const;
71  int propertyType() const;
72 
73  void setValue(const QVariant &value);
74  void setAttribute(const QString &attribute, const QVariant &value);
75 protected:
77 private:
79  QtVariantPropertyPrivate *d_ptr;
80 };
81 
82 class QtVariantPropertyManagerPrivate;
83 
85 {
86  Q_OBJECT
87 public:
88  QtVariantPropertyManager(QObject *parent = 0);
90 
91  virtual QtVariantProperty *addProperty(int propertyType, const QString &name = QString());
92 
93  int propertyType(const QtProperty *property) const;
94  int valueType(const QtProperty *property) const;
95  QtVariantProperty *variantProperty(const QtProperty *property) const;
96 
97  virtual bool isPropertyTypeSupported(int propertyType) const;
98  virtual int valueType(int propertyType) const;
99  virtual QStringList attributes(int propertyType) const;
100  virtual int attributeType(int propertyType, const QString &attribute) const;
101 
102  virtual QVariant value(const QtProperty *property) const;
103  virtual QVariant attributeValue(const QtProperty *property, const QString &attribute) const;
104 
105  static int enumTypeId();
106  static int flagTypeId();
107  static int groupTypeId();
108  static int iconMapTypeId();
109 public Q_SLOTS:
110  virtual void setValue(QtProperty *property, const QVariant &val);
111  virtual void setAttribute(QtProperty *property,
112  const QString &attribute, const QVariant &value);
113 Q_SIGNALS:
114  void valueChanged(QtProperty *property, const QVariant &val);
115  void attributeChanged(QtProperty *property,
116  const QString &attribute, const QVariant &val);
117 protected:
118  virtual bool hasValue(const QtProperty *property) const;
119  QString valueText(const QtProperty *property) const;
120  QIcon valueIcon(const QtProperty *property) const;
121  virtual void initializeProperty(QtProperty *property);
122  virtual void uninitializeProperty(QtProperty *property);
123  virtual QtProperty *createProperty();
124 private:
125  QtVariantPropertyManagerPrivate *d_ptr;
126  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, int))
127  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int))
128  Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, int))
129  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, double))
130  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, double, double))
131  Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, double))
132  Q_PRIVATE_SLOT(d_func(), void slotDecimalsChanged(QtProperty *, int))
133  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, bool))
134  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QString &))
135  Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegExp &))
136  Q_PRIVATE_SLOT(d_func(), void slotEchoModeChanged(QtProperty *, int))
137  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDate &))
138  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QDate &, const QDate &))
139  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QTime &))
140  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDateTime &))
141  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QKeySequence &))
142  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QChar &))
143  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QLocale &))
144  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QPoint &))
145  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QPointF &))
146  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QVector3D &))
147  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSize &))
148  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QSize &, const QSize &))
149  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSizeF &))
150  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QSizeF &, const QSizeF &))
151  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QRect &))
152  Q_PRIVATE_SLOT(d_func(), void slotConstraintChanged(QtProperty *, const QRect &))
153  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QRectF &))
154  Q_PRIVATE_SLOT(d_func(), void slotConstraintChanged(QtProperty *, const QRectF &))
155  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QColor &))
156  Q_PRIVATE_SLOT(d_func(), void slotEnumNamesChanged(QtProperty *, const QStringList &))
157  Q_PRIVATE_SLOT(d_func(), void slotEnumIconsChanged(QtProperty *, const QMap<int, QIcon> &))
158  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSizePolicy &))
159  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QFont &))
160  Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QCursor &))
161  Q_PRIVATE_SLOT(d_func(), void slotFlagNamesChanged(QtProperty *, const QStringList &))
162 
163  Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))
164  Q_PRIVATE_SLOT(d_func(), void slotPropertyRemoved(QtProperty *, QtProperty *))
165  Q_DECLARE_PRIVATE(QtVariantPropertyManager)
166  Q_DISABLE_COPY(QtVariantPropertyManager)
167 };
168 
169 class QtVariantEditorFactoryPrivate;
170 
172 {
173  Q_OBJECT
174 public:
175  QtVariantEditorFactory(QObject *parent = 0);
177 protected:
178  void connectPropertyManager(QtVariantPropertyManager *manager);
179  QWidget *createEditor(QtVariantPropertyManager *manager, QtProperty *property,
180  QWidget *parent);
181  void disconnectPropertyManager(QtVariantPropertyManager *manager);
182 private:
183  QtVariantEditorFactoryPrivate *d_ptr;
184  Q_DECLARE_PRIVATE(QtVariantEditorFactory)
185  Q_DISABLE_COPY(QtVariantEditorFactory)
186 };
187 
188 #if QT_VERSION >= 0x040400
189 QT_END_NAMESPACE
190 #endif
191 
192 Q_DECLARE_METATYPE(QIcon)
193 Q_DECLARE_METATYPE(QtIconMap)
194 #endif
virtual QtProperty * createProperty()
QtProperty * addProperty(const QString &name=QString())
QtVariantPropertyPrivate * d_ptr
Definition: qtvariantproperty.h:79
Definition: qtvariantproperty.h:84
Definition: qtpropertybrowser.h:115
virtual QString valueText(const QtProperty *property) const
Definition: qtpropertybrowser.h:167
virtual QIcon valueIcon(const QtProperty *property) const
QtVariantEditorFactoryPrivate * d_ptr
Definition: qtvariantproperty.h:183
QMap< int, QIcon > QtIconMap
Definition: qtvariantproperty.h:52
virtual void uninitializeProperty(QtProperty *property)
virtual void initializeProperty(QtProperty *property)=0
#define QT_QTPROPERTYBROWSER_EXPORT
Definition: qtpropertybrowser.h:59
virtual bool hasValue(const QtProperty *property) const
QtVariantPropertyManagerPrivate * d_ptr
Definition: qtvariantproperty.h:125
The description of this class will come soon !
Definition: qtvariantproperty.h:64
The description of this class will come soon !
Definition: qtpropertybrowser.h:74
Definition: qtvariantproperty.h:171