Go to the documentation of this file.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 #ifndef QXTITEMEDITORCREATORBASE_H
00026 #define QXTITEMEDITORCREATORBASE_H
00027
00028 #include <QHash>
00029 #include <QWidget>
00030 #include <QVariant>
00031 #include <QByteArray>
00032 #include <QHashIterator>
00033
00043 template <class T>
00044 class QXT_GUI_EXPORT QxtItemEditorCreatorBase
00045 {
00046 public:
00050 QVariant defaultPropertyValue(const QByteArray& property) const
00051 {
00052 return properties.value(property);
00053 }
00054
00058 void setDefaultPropertyValue(const QByteArray& property, const QVariant& value)
00059 {
00060 properties.insert(property, value);
00061 }
00062
00066 inline QWidget* initializeEditor(QWidget* editor) const;
00067
00068 private:
00069 QHash<QByteArray, QVariant> properties;
00070 };
00071
00072 template <class T>
00073 Q_INLINE_TEMPLATE QWidget* QxtItemEditorCreatorBase<T>::initializeEditor(QWidget* editor) const
00074 {
00075 QHashIterator<QByteArray, QVariant> i(properties);
00076 while (i.hasNext())
00077 {
00078 i.next();
00079 editor->setProperty(i.key(), i.value());
00080 }
00081 return editor;
00082 }
00083
00084 #endif // QXTITEMEDITORCREATORBASE_H