00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 #ifndef QTVARIANTPROPERTY_H
00089 #define QTVARIANTPROPERTY_H
00090
00091 #include "qtpropertybrowser.h"
00092 #include <QtCore/QVariant>
00093 #include <QtGui/QIcon>
00094
00095 #if QT_VERSION >= 0x040400
00096 QT_BEGIN_NAMESPACE
00097 #endif
00098
00099 typedef QMap<int, QIcon> QtIconMap;
00100
00101 class QtVariantPropertyManager;
00102 class QtVariantPropertyPrivate;
00103
00104 class QT_QTPROPERTYBROWSER_EXPORT QtVariantProperty : public QtProperty
00105 {
00106 public:
00107 ~QtVariantProperty();
00108 QVariant value() const;
00109 QVariant attributeValue(const QString &attribute) const;
00110 int valueType() const;
00111 int propertyType() const;
00112
00113 void setValue(const QVariant &value);
00114 void setAttribute(const QString &attribute, const QVariant &value);
00115 protected:
00116 QtVariantProperty(QtVariantPropertyManager *manager);
00117 private:
00118 friend class QtVariantPropertyManager;
00119 QtVariantPropertyPrivate *d_ptr;
00120 };
00121
00122 class QtVariantPropertyManagerPrivate;
00123
00124 class QT_QTPROPERTYBROWSER_EXPORT QtVariantPropertyManager : public QtAbstractPropertyManager
00125 {
00126 Q_OBJECT
00127 public:
00128 QtVariantPropertyManager(QObject *parent = 0);
00129 ~QtVariantPropertyManager();
00130
00131 virtual QtVariantProperty *addProperty(int propertyType, const QString &name = QString());
00132
00133 int propertyType(const QtProperty *property) const;
00134 int valueType(const QtProperty *property) const;
00135 QtVariantProperty *variantProperty(const QtProperty *property) const;
00136
00137 virtual bool isPropertyTypeSupported(int propertyType) const;
00138 virtual int valueType(int propertyType) const;
00139 virtual QStringList attributes(int propertyType) const;
00140 virtual int attributeType(int propertyType, const QString &attribute) const;
00141
00142 virtual QVariant value(const QtProperty *property) const;
00143 virtual QVariant attributeValue(const QtProperty *property, const QString &attribute) const;
00144
00145 static int enumTypeId();
00146 static int flagTypeId();
00147 static int groupTypeId();
00148 static int iconMapTypeId();
00149 public Q_SLOTS:
00150 virtual void setValue(QtProperty *property, const QVariant &val);
00151 virtual void setAttribute(QtProperty *property,
00152 const QString &attribute, const QVariant &value);
00153 Q_SIGNALS:
00154 void valueChanged(QtProperty *property, const QVariant &val);
00155 void attributeChanged(QtProperty *property,
00156 const QString &attribute, const QVariant &val);
00157 protected:
00158 virtual bool hasValue(const QtProperty *property) const;
00159 QString valueText(const QtProperty *property) const;
00160 QIcon valueIcon(const QtProperty *property) const;
00161 virtual void initializeProperty(QtProperty *property);
00162 virtual void uninitializeProperty(QtProperty *property);
00163 virtual QtProperty *createProperty();
00164 private:
00165 QtVariantPropertyManagerPrivate *d_ptr;
00166 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, int))
00167 Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int))
00168 Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, int))
00169 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, double))
00170 Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, double, double))
00171 Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, double))
00172 Q_PRIVATE_SLOT(d_func(), void slotDecimalsChanged(QtProperty *, int))
00173 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, bool))
00174 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QString &))
00175 Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegExp &))
00176 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDate &))
00177 Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QDate &, const QDate &))
00178 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QTime &))
00179 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDateTime &))
00180 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QKeySequence &))
00181 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QChar &))
00182 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QLocale &))
00183 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QPoint &))
00184 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QPointF &))
00185 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSize &))
00186 Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QSize &, const QSize &))
00187 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSizeF &))
00188 Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QSizeF &, const QSizeF &))
00189 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QRect &))
00190 Q_PRIVATE_SLOT(d_func(), void slotConstraintChanged(QtProperty *, const QRect &))
00191 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QRectF &))
00192 Q_PRIVATE_SLOT(d_func(), void slotConstraintChanged(QtProperty *, const QRectF &))
00193 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QColor &))
00194 Q_PRIVATE_SLOT(d_func(), void slotEnumNamesChanged(QtProperty *, const QStringList &))
00195 Q_PRIVATE_SLOT(d_func(), void slotEnumIconsChanged(QtProperty *, const QMap<int, QIcon> &))
00196 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSizePolicy &))
00197 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QFont &))
00198 Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QCursor &))
00199 Q_PRIVATE_SLOT(d_func(), void slotFlagNamesChanged(QtProperty *, const QStringList &))
00200
00201 Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))
00202 Q_PRIVATE_SLOT(d_func(), void slotPropertyRemoved(QtProperty *, QtProperty *))
00203 Q_DECLARE_PRIVATE(QtVariantPropertyManager)
00204 Q_DISABLE_COPY(QtVariantPropertyManager)
00205 };
00206
00207 class QtVariantEditorFactoryPrivate;
00208
00209 class QT_QTPROPERTYBROWSER_EXPORT QtVariantEditorFactory : public QtAbstractEditorFactory<QtVariantPropertyManager>
00210 {
00211 Q_OBJECT
00212 public:
00213 QtVariantEditorFactory(QObject *parent = 0);
00214 ~QtVariantEditorFactory();
00215 protected:
00216 void connectPropertyManager(QtVariantPropertyManager *manager);
00217 QWidget *createEditor(QtVariantPropertyManager *manager, QtProperty *property,
00218 QWidget *parent);
00219 void disconnectPropertyManager(QtVariantPropertyManager *manager);
00220 private:
00221 QtVariantEditorFactoryPrivate *d_ptr;
00222 Q_DECLARE_PRIVATE(QtVariantEditorFactory)
00223 Q_DISABLE_COPY(QtVariantEditorFactory)
00224 };
00225
00226 #if QT_VERSION >= 0x040400
00227 QT_END_NAMESPACE
00228 #endif
00229
00230 Q_DECLARE_METATYPE(QIcon)
00231 Q_DECLARE_METATYPE(QtIconMap)
00232 #endif