40 #pragma GCC system_header
42 #ifndef QTEDITORFACTORY_H
43 #define QTEDITORFACTORY_H
45 #include <QtGui/QSpinBox>
46 #include <QtGui/QScrollBar>
47 #include <QtGui/QComboBox>
48 #include <QtGui/QAbstractItemView>
49 #include <QtGui/QLineEdit>
50 #include <QtGui/QDateTimeEdit>
51 #include <QtGui/QHBoxLayout>
52 #include <QtGui/QMenu>
53 #include <QtGui/QKeyEvent>
54 #include <QtGui/QApplication>
55 #include <QtGui/QLabel>
56 #include <QtGui/QToolButton>
57 #include <QtGui/QColorDialog>
58 #include <QtGui/QFontDialog>
59 #include <QtGui/QSpacerItem>
60 #include <QtGui/QStyleOption>
61 #include <QtGui/QPainter>
62 #include <QtCore/QMap>
67 #if QT_VERSION >= 0x040400
76 template <
class Editor>
93 template <
class Editor>
97 Editor *editor =
new Editor(parent);
98 initializeEditor(property, editor);
102 template <
class Editor>
106 Q_TYPENAME PropertyToEditorListMap::iterator it =
107 m_createdEditors.find(property);
108 if (it == m_createdEditors.end())
109 it = m_createdEditors.insert(property,
EditorList());
110 it.value().append(editor);
111 m_editorToProperty.insert(editor, property);
114 template <
class Editor>
117 const Q_TYPENAME EditorToPropertyMap::iterator ecend =
118 m_editorToProperty.end();
119 for (Q_TYPENAME EditorToPropertyMap::iterator itEditor =
120 m_editorToProperty.begin(); itEditor != ecend; ++itEditor)
122 if (itEditor.key() == object)
124 Editor *editor = itEditor.key();
126 const Q_TYPENAME PropertyToEditorListMap::iterator pit =
127 m_createdEditors.find(property);
128 if (pit != m_createdEditors.end())
130 pit.value().removeAll(editor);
131 if (pit.value().empty())
132 m_createdEditors.erase(pit);
134 m_editorToProperty.erase(itEditor);
159 bool event(QEvent *e);
161 void slotClearChar();
163 void handleKeyEvent(QKeyEvent *e);
166 QLineEdit *m_lineEdit;
188 void buttonClicked();
192 QLabel *m_pixmapLabel;
194 QToolButton *m_button;
216 void buttonClicked();
220 QLabel *m_pixmapLabel;
222 QToolButton *m_button;
243 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
int))
244 Q_PRIVATE_SLOT(d_func(),
void slotRangeChanged(
QtProperty *,
int,
int))
245 Q_PRIVATE_SLOT(d_func(),
void slotSingleStepChanged(
QtProperty *,
int))
246 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
int))
247 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
257 void slotPropertyChanged(
QtProperty *property,
int value);
259 void slotSingleStepChanged(
QtProperty *property,
int step);
260 void slotSetValue(
int value);
283 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
int))
284 Q_PRIVATE_SLOT(d_func(),
void slotRangeChanged(
QtProperty *,
int,
int))
285 Q_PRIVATE_SLOT(d_func(),
void slotSingleStepChanged(
QtProperty *,
int))
286 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
int))
287 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
296 void slotPropertyChanged(
QtProperty *property,
int value);
298 void slotSingleStepChanged(
QtProperty *property,
int step);
299 void slotSetValue(
int value);
322 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
int))
323 Q_PRIVATE_SLOT(d_func(),
void slotRangeChanged(
QtProperty *,
int,
int))
324 Q_PRIVATE_SLOT(d_func(),
void slotSingleStepChanged(
QtProperty *,
int))
325 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
int))
326 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
335 void slotPropertyChanged(
QtProperty *property,
int value);
337 void slotSingleStepChanged(
QtProperty *property,
int step);
338 void slotSetValue(
int value);
361 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
bool))
362 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
bool))
363 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
372 void slotPropertyChanged(
QtProperty *property,
bool value);
373 void slotSetValue(
bool value);
397 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
double))
398 Q_PRIVATE_SLOT(d_func(),
void slotRangeChanged(
QtProperty *,
double,
400 Q_PRIVATE_SLOT(d_func(),
void slotSingleStepChanged(
QtProperty *,
double))
401 Q_PRIVATE_SLOT(d_func(),
void slotDecimalsChanged(
QtProperty *,
int))
402 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
double))
403 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
413 void slotPropertyChanged(
QtProperty *property,
double value);
415 void slotSingleStepChanged(
QtProperty *property,
double step);
416 void slotDecimalsChanged(
QtProperty *property,
int prec);
417 void slotSetValue(
double value);
441 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
443 Q_PRIVATE_SLOT(d_func(),
void slotRegExpChanged(
QtProperty *,
445 Q_PRIVATE_SLOT(d_func(),
void slotEchoModeChanged(
QtProperty *,
int))
446 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
const QString &))
447 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
457 void slotPropertyChanged(
QtProperty *property,
const QString &value);
458 void slotRegExpChanged(
QtProperty *property,
const QRegExp ®Exp);
459 void slotSetValue(
const QString &value);
483 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
485 Q_PRIVATE_SLOT(d_func(),
void slotRangeChanged(
QtProperty *,
486 const QDate &,
const QDate &))
487 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
const QDate &))
488 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
497 void slotPropertyChanged(
QtProperty *property,
const QDate &value);
498 void slotRangeChanged(
QtProperty *property,
const QDate &
min,
500 void slotSetValue(
const QDate &value);
523 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
525 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
const QTime &))
526 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
536 void slotPropertyChanged(
QtProperty *property,
const QTime &value);
537 void slotSetValue(
const QTime &value);
561 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
563 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
const QDateTime &))
564 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
575 void slotPropertyChanged(
QtProperty *property,
const QDateTime &value);
576 void slotSetValue(
const QDateTime &value);
600 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
601 const QKeySequence &))
602 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
const QKeySequence &))
603 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
614 void slotPropertyChanged(
QtProperty *property,
const QKeySequence &value);
615 void slotSetValue(
const QKeySequence &value);
637 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
639 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
const QChar &))
640 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
651 void slotPropertyChanged(
QtProperty *property,
const QChar &value);
652 void slotSetValue(
const QChar &value);
674 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
int))
675 Q_PRIVATE_SLOT(d_func(),
void slotEnumNamesChanged(
QtProperty *,
676 const QStringList &))
677 Q_PRIVATE_SLOT(d_func(),
void slotEnumIconsChanged(
QtProperty *,
678 const QMap<int, QIcon> &))
679 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
int))
680 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
691 void slotPropertyChanged(
QtProperty *property,
int value);
692 void slotEnumNamesChanged(
QtProperty *property,
const QStringList &);
693 void slotEnumIconsChanged(
QtProperty *property,
const QMap<int, QIcon> &);
694 void slotSetValue(
int value);
716 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
718 Q_PRIVATE_SLOT(d_func(),
void slotEnumChanged(
QtProperty *,
int))
719 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
729 void slotPropertyChanged(
QtProperty *property,
const QCursor &cursor);
730 void slotEnumChanged(
QtProperty *property,
int value);
731 void slotEditorDestroyed(QObject *
object);
736 QMap<QtProperty *, QtProperty *> m_propertyToEnum;
737 QMap<QtProperty *, QtProperty *> m_enumToProperty;
738 QMap<QtProperty *, QList<QWidget *> > m_enumToEditors;
739 QMap<QWidget *, QtProperty *> m_editorToEnum;
761 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
763 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
764 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
const QColor &))
775 void slotPropertyChanged(
QtProperty *property,
const QColor &value);
776 void slotSetValue(
const QColor &value);
798 Q_PRIVATE_SLOT(d_func(),
void slotPropertyChanged(
QtProperty *,
800 Q_PRIVATE_SLOT(d_func(),
void slotEditorDestroyed(QObject *))
801 Q_PRIVATE_SLOT(d_func(),
void slotSetValue(
const QFont &))
812 void slotPropertyChanged(
QtProperty *property,
const QFont &value);
813 void slotSetValue(
const QFont &value);
815 #if QT_VERSION >= 0x040400
Definition: qtpropertymanager.h:236
void paintEvent(QPaintEvent *e)
Definition: qteditorfactory.h:529
QList< Editor * > EditorList
Definition: qteditorfactory.h:81
Definition: qteditorfactory.h:424
Definition: qteditorfactory.h:583
Definition: qteditorfactory.h:804
Definition: qteditorfactory.h:768
Definition: qteditorfactory.h:607
void slotEditorDestroyed(QObject *object)
Definition: qteditorfactory.h:115
Definition: qteditorfactory.h:544
void initializeEditor(QtProperty *property, Editor *e)
Definition: qteditorfactory.h:103
void keyReleaseEvent(QKeyEvent *e)
void focusOutEvent(QFocusEvent *e)
bool eventFilter(QObject *o, QEvent *e)
Definition: qtpropertymanager.h:493
Definition: qteditorfactory.h:140
virtual void disconnectPropertyManager(PropertyManager *manager)=0
T min(const std::vector< T > &_values)
get the minimum value of vector of values
Definition: Helpers.hh:157
Definition: qteditorfactory.h:345
Definition: qteditorfactory.h:507
Definition: qtpropertymanager.h:300
Editor * createEditor(QtProperty *property, QWidget *parent)
Definition: qteditorfactory.h:94
QMap< Editor *, QtProperty * > EditorToPropertyMap
Definition: qteditorfactory.h:83
Definition: qtpropertymanager.h:532
Definition: qteditorfactory.h:380
Definition: qtpropertybrowser.h:209
Definition: qtpropertymanager.h:1222
Definition: qtpropertymanager.h:137
QMap< QtProperty *, EditorList > PropertyToEditorListMap
Definition: qteditorfactory.h:82
Definition: qtpropertymanager.h:1362
Definition: qtpropertymanager.h:415
Definition: qteditorfactory.h:722
Definition: qteditorfactory.h:643
Definition: qteditorfactory.h:782
Definition: qteditorfactory.h:406
Definition: qtpropertymanager.h:355
Definition: qtpropertymanager.h:1304
QWidget * createEditor(QtProperty *property, QWidget *parent)
Definition: qtpropertybrowser.h:214
Definition: qteditorfactory.h:365
Definition: qteditorfactory.h:700
Definition: qteditorfactory.h:449
Definition: qtpropertymanager.h:198
QtCharEdit(QWidget *parent=0)
Definition: qteditorfactory.h:250
Definition: qteditorfactory.h:567
Definition: qteditorfactory.h:289
Definition: qteditorfactory.h:745
Definition: qteditorfactory.h:621
Definition: qteditorfactory.h:490
void setValue(const QChar &value)
EditorToPropertyMap m_editorToProperty
Definition: qteditorfactory.h:90
#define NULL
Definition: CommonTypes.hh:31
#define QT_QTPROPERTYBROWSER_EXPORT
Definition: qtpropertybrowser.h:68
Definition: qteditorfactory.h:77
Definition: qtpropertymanager.h:454
Definition: qteditorfactory.h:227
Definition: qtpropertybrowser.h:77
void valueChanged(const QChar &value)
PropertyToEditorListMap m_createdEditors
Definition: qteditorfactory.h:89
Definition: qteditorfactory.h:267
virtual void connectPropertyManager(PropertyManager *manager)=0
Definition: qteditorfactory.h:683
T max(const std::vector< T > &_values)
get the maximum value of vector of values
Definition: Helpers.hh:144
void focusInEvent(QFocusEvent *e)
Definition: qtpropertymanager.h:1046
Definition: qteditorfactory.h:467
void keyPressEvent(QKeyEvent *e)
Definition: qteditorfactory.h:658