qteditorfactory.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 #pragma GCC system_header
41 
42 #ifndef QTEDITORFACTORY_H
43 #define QTEDITORFACTORY_H
44 
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>
63 
64 #include "qtpropertymanager.h"
66 
67 #if QT_VERSION >= 0x040400
68 QT_BEGIN_NAMESPACE
69 #endif
70 
71 // ---------- EditorFactoryPrivate :
72 
73 // Base class for editor factory private classes. Manages mapping of
74 // properties to editors and vice versa.
75 
76 template <class Editor>
78 {
79  public:
80 
81  typedef QList<Editor *> EditorList;
82  typedef QMap<QtProperty *, EditorList> PropertyToEditorListMap;
83  typedef QMap<Editor *, QtProperty *> EditorToPropertyMap;
84 
85  Editor *createEditor(QtProperty *property, QWidget *parent);
86  void initializeEditor(QtProperty *property, Editor *e);
87  void slotEditorDestroyed(QObject *object);
88 
91 };
92 
93  template <class Editor>
95  QWidget *parent)
96 {
97  Editor *editor = new Editor(parent);
98  initializeEditor(property, editor);
99  return editor;
100 }
101 
102  template <class Editor>
104  Editor *editor)
105 {
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);
112 }
113 
114  template <class Editor>
116 {
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)
121  {
122  if (itEditor.key() == object)
123  {
124  Editor *editor = itEditor.key();
125  QtProperty *property = itEditor.value();
126  const Q_TYPENAME PropertyToEditorListMap::iterator pit =
127  m_createdEditors.find(property);
128  if (pit != m_createdEditors.end())
129  {
130  pit.value().removeAll(editor);
131  if (pit.value().empty())
132  m_createdEditors.erase(pit);
133  }
134  m_editorToProperty.erase(itEditor);
135  return;
136  }
137  }
138 }
139 
141 : public QWidget
142 {
143  Q_OBJECT
144  public:
145  explicit QtCharEdit(QWidget *parent = 0);
146 
147  QChar value() const;
148  bool eventFilter(QObject *o, QEvent *e);
149  public Q_SLOTS:
150  void setValue(const QChar &value);
151  Q_SIGNALS:
152  void valueChanged(const QChar &value);
153  protected:
154  void focusInEvent(QFocusEvent *e);
155  void focusOutEvent(QFocusEvent *e);
156  void keyPressEvent(QKeyEvent *e);
157  void keyReleaseEvent(QKeyEvent *e);
158  void paintEvent(QPaintEvent *e);
159  bool event(QEvent *e);
160  private slots:
161  void slotClearChar();
162  private:
163  void handleKeyEvent(QKeyEvent *e);
164 
165  QChar m_value;
166  QLineEdit *m_lineEdit;
167 };
168 
170 : public QWidget {
171  Q_OBJECT
172 
173  public:
174  explicit QtColorEditWidget(QWidget *parent);
175 
176  bool eventFilter(QObject *obj, QEvent *ev);
177 
178  public Q_SLOTS:
179  void setValue(const QColor &value);
180 
181  Q_SIGNALS:
182  void valueChanged(const QColor &value);
183 
184  protected:
185  void paintEvent(QPaintEvent *e);
186 
187  private Q_SLOTS:
188  void buttonClicked();
189 
190  private:
191  QColor m_color;
192  QLabel *m_pixmapLabel;
193  QLabel *m_label;
194  QToolButton *m_button;
195 };
196 
198 : public QWidget {
199  Q_OBJECT
200 
201  public:
202  explicit QtFontEditWidget(QWidget *parent);
203 
204  bool eventFilter(QObject *obj, QEvent *ev);
205 
206  public Q_SLOTS:
207  void setValue(const QFont &value);
208 
209  Q_SIGNALS:
210  void valueChanged(const QFont &value);
211 
212  protected:
213  void paintEvent(QPaintEvent *e);
214 
215  private Q_SLOTS:
216  void buttonClicked();
217 
218  private:
219  QFont m_font;
220  QLabel *m_pixmapLabel;
221  QLabel *m_label;
222  QToolButton *m_button;
223 };
225 
226 
228 : public QtAbstractEditorFactory<QtIntPropertyManager>
229 {
230  Q_OBJECT
231  public:
232  explicit QtSpinBoxFactory(QObject *parent = 0);
233  ~QtSpinBoxFactory();
234  protected:
236  QWidget *createEditor(QtIntPropertyManager *manager, QtProperty *property,
237  QWidget *parent);
239  private:
241  Q_DECLARE_PRIVATE(QtSpinBoxFactory)
242  Q_DISABLE_COPY(QtSpinBoxFactory)
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 *))
248 };
249 
251 : public EditorFactoryPrivate<QSpinBox>
252 {
253  QtSpinBoxFactory *q_ptr;
254  Q_DECLARE_PUBLIC(QtSpinBoxFactory)
255  public:
256  QtSpinBoxFactoryPrivate() : q_ptr(NULL) {}
257  void slotPropertyChanged(QtProperty *property, int value);
258  void slotRangeChanged(QtProperty *property, int min, int max);
259  void slotSingleStepChanged(QtProperty *property, int step);
260  void slotSetValue(int value);
261 };
262 
263 
265 
266 
268 : public QtAbstractEditorFactory<QtIntPropertyManager>
269 {
270  Q_OBJECT
271  public:
272  explicit QtSliderFactory(QObject *parent = 0);
273  ~QtSliderFactory();
274  protected:
276  QWidget *createEditor(QtIntPropertyManager *manager, QtProperty *property,
277  QWidget *parent);
279  private:
280  QtSliderFactoryPrivate *d_ptr;
281  Q_DECLARE_PRIVATE(QtSliderFactory)
282  Q_DISABLE_COPY(QtSliderFactory)
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 *))
288 };
290 : public EditorFactoryPrivate<QSlider>
291 {
292  QtSliderFactory *q_ptr;
293  Q_DECLARE_PUBLIC(QtSliderFactory)
294  public:
295  QtSliderFactoryPrivate() : q_ptr(NULL) {}
296  void slotPropertyChanged(QtProperty *property, int value);
297  void slotRangeChanged(QtProperty *property, int min, int max);
298  void slotSingleStepChanged(QtProperty *property, int step);
299  void slotSetValue(int value);
300 };
301 
302 
304 
305 
307 : public QtAbstractEditorFactory<QtIntPropertyManager>
308 {
309  Q_OBJECT
310  public:
311  explicit QtScrollBarFactory(QObject *parent = 0);
313  protected:
315  QWidget *createEditor(QtIntPropertyManager *manager, QtProperty *property,
316  QWidget *parent);
318  private:
320  Q_DECLARE_PRIVATE(QtScrollBarFactory)
321  Q_DISABLE_COPY(QtScrollBarFactory)
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 *))
327 };
329 : public EditorFactoryPrivate<QScrollBar>
330 {
331  QtScrollBarFactory *q_ptr;
332  Q_DECLARE_PUBLIC(QtScrollBarFactory)
333  public:
334  QtScrollBarFactoryPrivate() : q_ptr(NULL) {}
335  void slotPropertyChanged(QtProperty *property, int value);
336  void slotRangeChanged(QtProperty *property, int min, int max);
337  void slotSingleStepChanged(QtProperty *property, int step);
338  void slotSetValue(int value);
339 };
340 
341 
343 
344 
346 : public QtAbstractEditorFactory<QtBoolPropertyManager>
347 {
348  Q_OBJECT
349  public:
350  explicit QtCheckBoxFactory(QObject *parent = 0);
352  protected:
354  QWidget *createEditor(QtBoolPropertyManager *manager, QtProperty *property,
355  QWidget *parent);
357  private:
359  Q_DECLARE_PRIVATE(QtCheckBoxFactory)
360  Q_DISABLE_COPY(QtCheckBoxFactory)
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 *))
364 };
366 : public EditorFactoryPrivate<QtBoolEdit>
367 {
368  QtCheckBoxFactory *q_ptr;
369  Q_DECLARE_PUBLIC(QtCheckBoxFactory)
370  public:
371  QtCheckBoxFactoryPrivate() : q_ptr(NULL) {}
372  void slotPropertyChanged(QtProperty *property, bool value);
373  void slotSetValue(bool value);
374 };
375 
376 
378 
379 
381 : public QtAbstractEditorFactory<QtDoublePropertyManager>
382 {
383  Q_OBJECT
384  public:
385  explicit QtDoubleSpinBoxFactory(QObject *parent = 0);
387  protected:
389  QWidget *createEditor(QtDoublePropertyManager *manager,
390  QtProperty *property,
391  QWidget *parent);
393  private:
395  Q_DECLARE_PRIVATE(QtDoubleSpinBoxFactory)
396  Q_DISABLE_COPY(QtDoubleSpinBoxFactory)
397  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, double))
398  Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, double,
399  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 *))
404 };
405 
407 : public EditorFactoryPrivate<QDoubleSpinBox>
408 {
409  QtDoubleSpinBoxFactory *q_ptr;
410  Q_DECLARE_PUBLIC(QtDoubleSpinBoxFactory)
411  public:
412  QtDoubleSpinBoxFactoryPrivate() : q_ptr(NULL) {}
413  void slotPropertyChanged(QtProperty *property, double value);
414  void slotRangeChanged(QtProperty *property, double min, double max);
415  void slotSingleStepChanged(QtProperty *property, double step);
416  void slotDecimalsChanged(QtProperty *property, int prec);
417  void slotSetValue(double value);
418 };
419 
420 
422 
423 
425 : public QtAbstractEditorFactory<QtStringPropertyManager>
426 {
427  Q_OBJECT
428  public:
429  explicit QtLineEditFactory(QObject *parent = 0);
431  protected:
433  QWidget *createEditor(QtStringPropertyManager *manager,
434  QtProperty *property,
435  QWidget *parent);
437  private:
439  Q_DECLARE_PRIVATE(QtLineEditFactory)
440  Q_DISABLE_COPY(QtLineEditFactory)
441  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *,
442  const QString &))
443  Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *,
444  const QRegExp &))
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 *))
448 };
450 : public EditorFactoryPrivate<QLineEdit>
451 {
452  QtLineEditFactory *q_ptr;
453  Q_DECLARE_PUBLIC(QtLineEditFactory)
454  public:
455  QtLineEditFactoryPrivate() : q_ptr(NULL) {}
456 
457  void slotPropertyChanged(QtProperty *property, const QString &value);
458  void slotRegExpChanged(QtProperty *property, const QRegExp &regExp);
459  void slotSetValue(const QString &value);
460  void slotEchoModeChanged(QtProperty *, int);
461 };
462 
463 
465 
466 
468 : public QtAbstractEditorFactory<QtDatePropertyManager>
469 {
470  Q_OBJECT
471  public:
472  explicit QtDateEditFactory(QObject *parent = 0);
474  protected:
476  QWidget *createEditor(QtDatePropertyManager *manager, QtProperty *property,
477  QWidget *parent);
479  private:
481  Q_DECLARE_PRIVATE(QtDateEditFactory)
482  Q_DISABLE_COPY(QtDateEditFactory)
483  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *,
484  const QDate &))
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 *))
489 };
491 : public EditorFactoryPrivate<QDateEdit>
492 {
493  QtDateEditFactory *q_ptr;
494  Q_DECLARE_PUBLIC(QtDateEditFactory)
495  public:
496  QtDateEditFactoryPrivate() : q_ptr(NULL) {}
497  void slotPropertyChanged(QtProperty *property, const QDate &value);
498  void slotRangeChanged(QtProperty *property, const QDate &min,
499  const QDate &max);
500  void slotSetValue(const QDate &value);
501 };
502 
503 
505 
506 
508 : public QtAbstractEditorFactory<QtTimePropertyManager>
509 {
510  Q_OBJECT
511  public:
512  explicit QtTimeEditFactory(QObject *parent = 0);
514  protected:
516  QWidget *createEditor(QtTimePropertyManager *manager, QtProperty *property,
517  QWidget *parent);
519  private:
521  Q_DECLARE_PRIVATE(QtTimeEditFactory)
522  Q_DISABLE_COPY(QtTimeEditFactory)
523  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *,
524  const QTime &))
525  Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QTime &))
526  Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
527 };
528 
530 : public EditorFactoryPrivate<QTimeEdit>
531 {
532  QtTimeEditFactory *q_ptr;
533  Q_DECLARE_PUBLIC(QtTimeEditFactory)
534  public:
535  QtTimeEditFactoryPrivate() : q_ptr(NULL) {}
536  void slotPropertyChanged(QtProperty *property, const QTime &value);
537  void slotSetValue(const QTime &value);
538 };
539 
540 
542 
543 
545 : public QtAbstractEditorFactory<QtDateTimePropertyManager>
546 {
547  Q_OBJECT
548  public:
549  explicit QtDateTimeEditFactory(QObject *parent = 0);
551  protected:
553  QWidget *createEditor(QtDateTimePropertyManager *manager,
554  QtProperty *property,
555  QWidget *parent);
557  private:
559  Q_DECLARE_PRIVATE(QtDateTimeEditFactory)
560  Q_DISABLE_COPY(QtDateTimeEditFactory)
561  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *,
562  const QDateTime &))
563  Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QDateTime &))
564  Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
565 };
566 
568 : public EditorFactoryPrivate<QDateTimeEdit>
569 {
570  QtDateTimeEditFactory *q_ptr;
571  Q_DECLARE_PUBLIC(QtDateTimeEditFactory)
572  public:
573  QtDateTimeEditFactoryPrivate() : q_ptr(NULL) {}
574 
575  void slotPropertyChanged(QtProperty *property, const QDateTime &value);
576  void slotSetValue(const QDateTime &value);
577 };
578 
579 
581 
582 
584 : public QtAbstractEditorFactory<QtKeySequencePropertyManager>
585 {
586  Q_OBJECT
587  public:
588  explicit QtKeySequenceEditorFactory(QObject *parent = 0);
590  protected:
592  QWidget *createEditor(QtKeySequencePropertyManager *manager,
593  QtProperty *property,
594  QWidget *parent);
596  private:
598  Q_DECLARE_PRIVATE(QtKeySequenceEditorFactory)
599  Q_DISABLE_COPY(QtKeySequenceEditorFactory)
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 *))
604 };
605 
606 
608 : public EditorFactoryPrivate<QtKeySequenceEdit>
609 {
611  Q_DECLARE_PUBLIC(QtKeySequenceEditorFactory)
612  public:
614  void slotPropertyChanged(QtProperty *property, const QKeySequence &value);
615  void slotSetValue(const QKeySequence &value);
616 };
617 
619 
620 
622 : public QtAbstractEditorFactory<QtCharPropertyManager>
623 {
624  Q_OBJECT
625  public:
626  explicit QtCharEditorFactory(QObject *parent = 0);
628  protected:
630  QWidget *createEditor(QtCharPropertyManager *manager, QtProperty *property,
631  QWidget *parent);
633  private:
635  Q_DECLARE_PRIVATE(QtCharEditorFactory)
636  Q_DISABLE_COPY(QtCharEditorFactory)
637  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *,
638  const QChar &))
639  Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QChar &))
640  Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
641 };
642 
644 : public EditorFactoryPrivate<QtCharEdit>
645 {
646  QtCharEditorFactory *q_ptr;
647  Q_DECLARE_PUBLIC(QtCharEditorFactory)
648  public:
649  QtCharEditorFactoryPrivate() : q_ptr(NULL) {}
650 
651  void slotPropertyChanged(QtProperty *property, const QChar &value);
652  void slotSetValue(const QChar &value);
653 };
654 
656 
657 
659 : public QtAbstractEditorFactory<QtEnumPropertyManager>
660 {
661  Q_OBJECT
662  public:
663  explicit QtEnumEditorFactory(QObject *parent = 0);
665  protected:
667  QWidget *createEditor(QtEnumPropertyManager *manager, QtProperty *property,
668  QWidget *parent);
670  private:
672  Q_DECLARE_PRIVATE(QtEnumEditorFactory)
673  Q_DISABLE_COPY(QtEnumEditorFactory)
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 *))
681 };
682 
684 : public EditorFactoryPrivate<QComboBox>
685 {
686  QtEnumEditorFactory *q_ptr;
687  Q_DECLARE_PUBLIC(QtEnumEditorFactory)
688  public:
689  QtEnumEditorFactoryPrivate() : q_ptr(NULL) {}
690 
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);
695 };
696 
697 
699 
701 : public QtAbstractEditorFactory<QtCursorPropertyManager>
702 {
703  Q_OBJECT
704  public:
705  explicit QtCursorEditorFactory(QObject *parent = 0);
707  protected:
709  QWidget *createEditor(QtCursorPropertyManager *manager,
710  QtProperty *property, QWidget *parent);
712  private:
714  Q_DECLARE_PRIVATE(QtCursorEditorFactory)
715  Q_DISABLE_COPY(QtCursorEditorFactory)
716  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *,
717  const QCursor &))
718  Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int))
719  Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
720 };
721 
723 {
724  QtCursorEditorFactory *q_ptr;
725  Q_DECLARE_PUBLIC(QtCursorEditorFactory)
726  public:
728 
729  void slotPropertyChanged(QtProperty *property, const QCursor &cursor);
730  void slotEnumChanged(QtProperty *property, int value);
731  void slotEditorDestroyed(QObject *object);
732 
733  QtEnumEditorFactory *m_enumEditorFactory;
734  QtEnumPropertyManager *m_enumPropertyManager;
735 
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;
740  bool m_updatingEnum;
741 };
743 
744 
746 : public QtAbstractEditorFactory<QtColorPropertyManager>
747 {
748  Q_OBJECT
749  public:
750  explicit QtColorEditorFactory(QObject *parent = 0);
752  protected:
754  QWidget *createEditor(QtColorPropertyManager *manager, QtProperty *property,
755  QWidget *parent);
757  private:
759  Q_DECLARE_PRIVATE(QtColorEditorFactory)
760  Q_DISABLE_COPY(QtColorEditorFactory)
761  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *,
762  const QColor &))
763  Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
764  Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QColor &))
765 };
766 
767 
769 : public EditorFactoryPrivate<QtColorEditWidget>
770 {
771  QtColorEditorFactory *q_ptr;
772  Q_DECLARE_PUBLIC(QtColorEditorFactory)
773  public:
774  QtColorEditorFactoryPrivate() : q_ptr(NULL) {}
775  void slotPropertyChanged(QtProperty *property, const QColor &value);
776  void slotSetValue(const QColor &value);
777 };
778 
780 
781 
783 : public QtAbstractEditorFactory<QtFontPropertyManager>
784 {
785  Q_OBJECT
786  public:
787  explicit QtFontEditorFactory(QObject *parent = 0);
789  protected:
791  QWidget *createEditor(QtFontPropertyManager *manager, QtProperty *property,
792  QWidget *parent);
794  private:
796  Q_DECLARE_PRIVATE(QtFontEditorFactory)
797  Q_DISABLE_COPY(QtFontEditorFactory)
798  Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *,
799  const QFont &))
800  Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
801  Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QFont &))
802 };
803 
805 : public EditorFactoryPrivate<QtFontEditWidget>
806 {
807  QtFontEditorFactory *q_ptr;
808  Q_DECLARE_PUBLIC(QtFontEditorFactory)
809  public:
810  QtFontEditorFactoryPrivate() : q_ptr(NULL) {}
811 
812  void slotPropertyChanged(QtProperty *property, const QFont &value);
813  void slotSetValue(const QFont &value);
814 };
815 #if QT_VERSION >= 0x040400
816 QT_END_NAMESPACE
817 #endif
818 
819 #endif
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
QtColorEditWidget(QWidget *parent)
Definition: qteditorfactory.h:804
void paintEvent(QPaintEvent *e)
void valueChanged(const QColor &value)
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)
void setValue(const QColor &value)
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
void valueChanged(const QFont &value)
Definition: qtpropertybrowser.h:209
Definition: qteditorfactory.h:197
Definition: qtpropertymanager.h:1222
Definition: qtpropertymanager.h:137
QMap< QtProperty *, EditorList > PropertyToEditorListMap
Definition: qteditorfactory.h:82
bool event(QEvent *e)
Definition: qtpropertymanager.h:1362
Definition: qtpropertymanager.h:415
Definition: qteditorfactory.h:722
bool eventFilter(QObject *obj, QEvent *ev)
bool eventFilter(QObject *obj, QEvent *ev)
Definition: qteditorfactory.h:643
Definition: qteditorfactory.h:306
Definition: qteditorfactory.h:782
QtFontEditWidget(QWidget *parent)
Definition: qteditorfactory.h:406
Definition: qtpropertymanager.h:355
Definition: qtpropertymanager.h:1304
QWidget * createEditor(QtProperty *property, QWidget *parent)
Definition: qtpropertybrowser.h:214
void paintEvent(QPaintEvent *e)
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
QChar value() const
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:30
#define QT_QTPROPERTYBROWSER_EXPORT
Definition: qtpropertybrowser.h:68
Definition: qteditorfactory.h:77
Definition: qteditorfactory.h:328
Definition: qteditorfactory.h:169
Definition: qtpropertymanager.h:454
void setValue(const QFont &value)
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