qtpropertybrowser.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the Qt Solutions component.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** You may use this file under the terms of the BSD license as follows:
10 **
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
13 ** met:
14 ** * Redistributions of source code must retain the above copyright
15 ** notice, this list of conditions and the following disclaimer.
16 ** * Redistributions in binary form must reproduce the above copyright
17 ** notice, this list of conditions and the following disclaimer in
18 ** the documentation and/or other materials provided with the
19 ** distribution.
20 ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 ** of its contributors may be used to endorse or promote products derived
22 ** from this software without specific prior written permission.
23 **
24 **
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 
42 #include "qtpropertybrowser.h"
43 #include <QSet>
44 #include <QMap>
45 #include <QIcon>
46 #include <QLineEdit>
47 
48 #if defined(Q_CC_MSVC)
49 # pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */
50 #endif
51 
52 QT_BEGIN_NAMESPACE
53 
55 {
56 public:
58  : m_enabled(true),
59  m_modified(false),
60  m_manager(manager) {}
62 
63  QSet<QtProperty*> m_parentItems;
64  QList<QtProperty*> m_subItems;
65 
66  QString m_toolTip;
67  QString m_statusTip;
68  QString m_whatsThis;
69  QString m_name;
70  bool m_enabled;
71  bool m_modified;
72 
74 };
75 
77 {
79  Q_DECLARE_PUBLIC(QtAbstractPropertyManager)
80 public:
81  void propertyDestroyed(QtProperty* property);
82  void propertyChanged(QtProperty* property) const;
83  void propertyRemoved(QtProperty* property,
84  QtProperty* parentProperty) const;
85  void propertyInserted(QtProperty* property, QtProperty* parentProperty,
86  QtProperty* afterProperty) const;
87 
88  QSet<QtProperty*> m_properties;
89 };
90 
91 /*!
92  \class QtProperty
93 
94  \brief The QtProperty class encapsulates an instance of a property.
95 
96  Properties are created by objects of QtAbstractPropertyManager
97  subclasses; a manager can create properties of a given type, and
98  is used in conjunction with the QtAbstractPropertyBrowser class. A
99  property is always owned by the manager that created it, which can
100  be retrieved using the propertyManager() function.
101 
102  QtProperty contains the most common property attributes, and
103  provides functions for retrieving as well as setting their values:
104 
105  \table
106  \header \o Getter \o Setter
107  \row
108  \o propertyName() \o setPropertyName()
109  \row
110  \o statusTip() \o setStatusTip()
111  \row
112  \o toolTip() \o setToolTip()
113  \row
114  \o whatsThis() \o setWhatsThis()
115  \row
116  \o isEnabled() \o setEnabled()
117  \row
118  \o isModified() \o setModified()
119  \row
120  \o valueText() \o Nop
121  \row
122  \o valueIcon() \o Nop
123  \endtable
124 
125  It is also possible to nest properties: QtProperty provides the
126  addSubProperty(), insertSubProperty() and removeSubProperty() functions to
127  manipulate the set of subproperties. Use the subProperties()
128  function to retrieve a property's current set of subproperties.
129  Note that nested properties are not owned by the parent property,
130  i.e. each subproperty is owned by the manager that created it.
131 
132  \sa QtAbstractPropertyManager, QtBrowserItem
133 */
134 
135 /*!
136  Creates a property with the given \a manager.
137 
138  This constructor is only useful when creating a custom QtProperty
139  subclass (e.g. QtVariantProperty). To create a regular QtProperty
140  object, use the QtAbstractPropertyManager::addProperty()
141  function instead.
142 
143  \sa QtAbstractPropertyManager::addProperty()
144 */
146 {
147  d_ptr = new QtPropertyPrivate(manager);
148  d_ptr->q_ptr = this;
149 }
150 
151 /*!
152  Destroys this property.
153 
154  Note that subproperties are detached but not destroyed, i.e. they
155  can still be used in another context.
156 
157  \sa QtAbstractPropertyManager::clear()
158 
159 */
161 {
162  QSetIterator<QtProperty*> itParent(d_ptr->m_parentItems);
163 
164  while (itParent.hasNext())
165  {
166  QtProperty* property = itParent.next();
167  property->d_ptr->m_manager->d_ptr->propertyRemoved(this, property);
168  }
169 
170  d_ptr->m_manager->d_ptr->propertyDestroyed(this);
171 
172  QListIterator<QtProperty*> itChild(d_ptr->m_subItems);
173 
174  while (itChild.hasNext())
175  {
176  QtProperty* property = itChild.next();
177  property->d_ptr->m_parentItems.remove(this);
178  }
179 
180  itParent.toFront();
181 
182  while (itParent.hasNext())
183  {
184  QtProperty* property = itParent.next();
185  property->d_ptr->m_subItems.removeAll(this);
186  }
187 
188  delete d_ptr;
189 }
190 
191 /*!
192  Returns the set of subproperties.
193 
194  Note that subproperties are not owned by \e this property, but by
195  the manager that created them.
196 
197  \sa insertSubProperty(), removeSubProperty()
198 */
199 QList<QtProperty*> QtProperty::subProperties() const
200 {
201  return d_ptr->m_subItems;
202 }
203 
204 /*!
205  Returns a pointer to the manager that owns this property.
206 */
208 {
209  return d_ptr->m_manager;
210 }
211 
212 /*!
213  Returns the property's tool tip.
214 
215  \sa setToolTip()
216 */
217 QString QtProperty::toolTip() const
218 {
219  return d_ptr->m_toolTip;
220 }
221 
222 /*!
223  Returns the property's status tip.
224 
225  \sa setStatusTip()
226 */
227 QString QtProperty::statusTip() const
228 {
229  return d_ptr->m_statusTip;
230 }
231 
232 /*!
233  Returns the property's "What's This" help text.
234 
235  \sa setWhatsThis()
236 */
237 QString QtProperty::whatsThis() const
238 {
239  return d_ptr->m_whatsThis;
240 }
241 
242 /*!
243  Returns the property's name.
244 
245  \sa setPropertyName()
246 */
248 {
249  return d_ptr->m_name;
250 }
251 
252 /*!
253  Returns whether the property is enabled.
254 
255  \sa setEnabled()
256 */
258 {
259  return d_ptr->m_enabled;
260 }
261 
262 /*!
263  Returns whether the property is modified.
264 
265  \sa setModified()
266 */
268 {
269  return d_ptr->m_modified;
270 }
271 
272 /*!
273  Returns whether the property has a value.
274 
275  \sa QtAbstractPropertyManager::hasValue()
276 */
278 {
279  return d_ptr->m_manager->hasValue(this);
280 }
281 
282 /*!
283  Returns an icon representing the current state of this property.
284 
285  If the given property type can not generate such an icon, this
286  function returns an invalid icon.
287 
288  \sa QtAbstractPropertyManager::valueIcon()
289 */
291 {
292  return d_ptr->m_manager->valueIcon(this);
293 }
294 
295 /*!
296  Returns a string representing the current state of this property.
297 
298  If the given property type can not generate such a string, this
299  function returns an empty string.
300 
301  \sa QtAbstractPropertyManager::valueText()
302 */
303 QString QtProperty::valueText() const
304 {
305  return d_ptr->m_manager->valueText(this);
306 }
307 
308 /*!
309  Returns the display text according to the echo-mode set on the editor.
310 
311  When the editor is a QLineEdit, this will return a string equal to what
312  is displayed.
313 
314  \sa QtAbstractPropertyManager::valueText()
315 */
316 QString QtProperty::displayText() const
317 {
318  return d_ptr->m_manager->displayText(this);
319 }
320 
321 /*!
322  Sets the property's tool tip to the given \a text.
323 
324  \sa toolTip()
325 */
326 void QtProperty::setToolTip(const QString& text)
327 {
328  if (d_ptr->m_toolTip == text)
329  {
330  return;
331  }
332 
333  d_ptr->m_toolTip = text;
334  propertyChanged();
335 }
336 
337 /*!
338  Sets the property's status tip to the given \a text.
339 
340  \sa statusTip()
341 */
342 void QtProperty::setStatusTip(const QString& text)
343 {
344  if (d_ptr->m_statusTip == text)
345  {
346  return;
347  }
348 
349  d_ptr->m_statusTip = text;
350  propertyChanged();
351 }
352 
353 /*!
354  Sets the property's "What's This" help text to the given \a text.
355 
356  \sa whatsThis()
357 */
358 void QtProperty::setWhatsThis(const QString& text)
359 {
360  if (d_ptr->m_whatsThis == text)
361  {
362  return;
363  }
364 
365  d_ptr->m_whatsThis = text;
366  propertyChanged();
367 }
368 
369 /*!
370  \fn void QtProperty::setPropertyName(const QString &name)
371 
372  Sets the property's name to the given \a name.
373 
374  \sa propertyName()
375 */
376 void QtProperty::setPropertyName(const QString& text)
377 {
378  if (d_ptr->m_name == text)
379  {
380  return;
381  }
382 
383  d_ptr->m_name = text;
384  propertyChanged();
385 }
386 
387 /*!
388  Enables or disables the property according to the passed \a enable value.
389 
390  \sa isEnabled()
391 */
392 void QtProperty::setEnabled(bool enable)
393 {
394  if (d_ptr->m_enabled == enable)
395  {
396  return;
397  }
398 
399  d_ptr->m_enabled = enable;
400  propertyChanged();
401 }
402 
403 /*!
404  Sets the property's modified state according to the passed \a modified value.
405 
406  \sa isModified()
407 */
408 void QtProperty::setModified(bool modified)
409 {
410  if (d_ptr->m_modified == modified)
411  {
412  return;
413  }
414 
415  d_ptr->m_modified = modified;
416  propertyChanged();
417 }
418 
419 /*!
420  Appends the given \a property to this property's subproperties.
421 
422  If the given \a property already is added, this function does
423  nothing.
424 
425  \sa insertSubProperty(), removeSubProperty()
426 */
428 {
429  QtProperty* after = 0;
430 
431  if (d_ptr->m_subItems.count() > 0)
432  {
433  after = d_ptr->m_subItems.last();
434  }
435 
436  insertSubProperty(property, after);
437 }
438 
439 /*!
440  \fn void QtProperty::insertSubProperty(QtProperty *property, QtProperty *precedingProperty)
441 
442  Inserts the given \a property after the specified \a
443  precedingProperty into this property's list of subproperties. If
444  \a precedingProperty is 0, the specified \a property is inserted
445  at the beginning of the list.
446 
447  If the given \a property already is inserted, this function does
448  nothing.
449 
450  \sa addSubProperty(), removeSubProperty()
451 */
453  QtProperty* afterProperty)
454 {
455  if (!property)
456  {
457  return;
458  }
459 
460  if (property == this)
461  {
462  return;
463  }
464 
465  // traverse all children of item. if this item is a child of item then cannot add.
466  QList<QtProperty*> pendingList = property->subProperties();
467  QMap<QtProperty*, bool> visited;
468 
469  while (!pendingList.isEmpty())
470  {
471  QtProperty* i = pendingList.first();
472 
473  if (i == this)
474  {
475  return;
476  }
477 
478  pendingList.removeFirst();
479 
480  if (visited.contains(i))
481  {
482  continue;
483  }
484 
485  visited[i] = true;
486  pendingList += i->subProperties();
487  }
488 
489  pendingList = subProperties();
490  int pos = 0;
491  int newPos = 0;
492  QtProperty* properAfterProperty = 0;
493 
494  while (pos < pendingList.count())
495  {
496  QtProperty* i = pendingList.at(pos);
497 
498  if (i == property)
499  {
500  return; // if item is already inserted in this item then cannot add.
501  }
502 
503  if (i == afterProperty)
504  {
505  newPos = pos + 1;
506  properAfterProperty = afterProperty;
507  }
508 
509  pos++;
510  }
511 
512  d_ptr->m_subItems.insert(newPos, property);
513  property->d_ptr->m_parentItems.insert(this);
514 
515  d_ptr->m_manager->d_ptr->propertyInserted(property, this, properAfterProperty);
516 }
517 
518 /*!
519  Removes the given \a property from the list of subproperties
520  without deleting it.
521 
522  \sa addSubProperty(), insertSubProperty()
523 */
525 {
526  if (!property)
527  {
528  return;
529  }
530 
531  d_ptr->m_manager->d_ptr->propertyRemoved(property, this);
532 
533  QList<QtProperty*> pendingList = subProperties();
534  int pos = 0;
535 
536  while (pos < pendingList.count())
537  {
538  if (pendingList.at(pos) == property)
539  {
540  d_ptr->m_subItems.removeAt(pos);
541  property->d_ptr->m_parentItems.remove(this);
542 
543  return;
544  }
545 
546  pos++;
547  }
548 }
549 
550 /*!
551  \internal
552 */
554 {
555  d_ptr->m_manager->d_ptr->propertyChanged(this);
556 }
557 
558 ////////////////////////////////
559 
561 {
562  if (m_properties.contains(property))
563  {
564  emit q_ptr->propertyDestroyed(property);
565  q_ptr->uninitializeProperty(property);
566  m_properties.remove(property);
567  }
568 }
569 
571 {
572  emit q_ptr->propertyChanged(property);
573 }
574 
576  QtProperty* parentProperty) const
577 {
578  emit q_ptr->propertyRemoved(property, parentProperty);
579 }
580 
582  QtProperty* parentProperty, QtProperty* afterProperty) const
583 {
584  emit q_ptr->propertyInserted(property, parentProperty, afterProperty);
585 }
586 
587 /*!
588  \class QtAbstractPropertyManager
589 
590  \brief The QtAbstractPropertyManager provides an interface for
591  property managers.
592 
593  A manager can create and manage properties of a given type, and is
594  used in conjunction with the QtAbstractPropertyBrowser class.
595 
596  When using a property browser widget, the properties are created
597  and managed by implementations of the QtAbstractPropertyManager
598  class. To ensure that the properties' values will be displayed
599  using suitable editing widgets, the managers are associated with
600  objects of QtAbstractEditorFactory subclasses. The property browser
601  will use these associations to determine which factories it should
602  use to create the preferred editing widgets.
603 
604  The QtAbstractPropertyManager class provides common functionality
605  like creating a property using the addProperty() function, and
606  retrieving the properties created by the manager using the
607  properties() function. The class also provides signals that are
608  emitted when the manager's properties change: propertyInserted(),
609  propertyRemoved(), propertyChanged() and propertyDestroyed().
610 
611  QtAbstractPropertyManager subclasses are supposed to provide their
612  own type specific API. Note that several ready-made
613  implementations are available:
614 
615  \list
616  \o QtBoolPropertyManager
617  \o QtColorPropertyManager
618  \o QtDatePropertyManager
619  \o QtDateTimePropertyManager
620  \o QtDoublePropertyManager
621  \o QtEnumPropertyManager
622  \o QtFlagPropertyManager
623  \o QtFontPropertyManager
624  \o QtGroupPropertyManager
625  \o QtIntPropertyManager
626  \o QtPointPropertyManager
627  \o QtRectPropertyManager
628  \o QtSizePropertyManager
629  \o QtSizePolicyPropertyManager
630  \o QtStringPropertyManager
631  \o QtTimePropertyManager
632  \o QtVariantPropertyManager
633  \endlist
634 
635  \sa QtAbstractEditorFactoryBase, QtAbstractPropertyBrowser, QtProperty
636 */
637 
638 /*!
639  \fn void QtAbstractPropertyManager::propertyInserted(QtProperty *newProperty,
640  QtProperty *parentProperty, QtProperty *precedingProperty)
641 
642  This signal is emitted when a new subproperty is inserted into an
643  existing property, passing pointers to the \a newProperty, \a
644  parentProperty and \a precedingProperty as parameters.
645 
646  If \a precedingProperty is 0, the \a newProperty was inserted at
647  the beginning of the \a parentProperty's subproperties list.
648 
649  Note that signal is emitted only if the \a parentProperty is created
650  by this manager.
651 
652  \sa QtAbstractPropertyBrowser::itemInserted()
653 */
654 
655 /*!
656  \fn void QtAbstractPropertyManager::propertyChanged(QtProperty *property)
657 
658  This signal is emitted whenever a property's data changes, passing
659  a pointer to the \a property as parameter.
660 
661  Note that signal is only emitted for properties that are created by
662  this manager.
663 
664  \sa QtAbstractPropertyBrowser::itemChanged()
665 */
666 
667 /*!
668  \fn void QtAbstractPropertyManager::propertyRemoved(QtProperty *property, QtProperty *parent)
669 
670  This signal is emitted when a subproperty is removed, passing
671  pointers to the removed \a property and the \a parent property as
672  parameters.
673 
674  Note that signal is emitted only when the \a parent property is
675  created by this manager.
676 
677  \sa QtAbstractPropertyBrowser::itemRemoved()
678 */
679 
680 /*!
681  \fn void QtAbstractPropertyManager::propertyDestroyed(QtProperty *property)
682 
683  This signal is emitted when the specified \a property is about to
684  be destroyed.
685 
686  Note that signal is only emitted for properties that are created
687  by this manager.
688 
689  \sa clear(), uninitializeProperty()
690 */
691 
692 /*!
693  \fn void QtAbstractPropertyBrowser::currentItemChanged(QtBrowserItem *current)
694 
695  This signal is emitted when the current item changes. The current item is specified by \a current.
696 
697  \sa QtAbstractPropertyBrowser::setCurrentItem()
698 */
699 
700 /*!
701  Creates an abstract property manager with the given \a parent.
702 */
704  : QObject(parent)
705 {
707  d_ptr->q_ptr = this;
708 
709 }
710 
711 /*!
712  Destroys the manager. All properties created by the manager are
713  destroyed.
714 */
716 {
717  clear();
718  delete d_ptr;
719 }
720 
721 /*!
722  Destroys all the properties that this manager has created.
723 
724  \sa propertyDestroyed(), uninitializeProperty()
725 */
727 {
728  while (!properties().isEmpty())
729  {
730  QSetIterator<QtProperty*> itProperty(properties());
731  QtProperty* prop = itProperty.next();
732  delete prop;
733  }
734 }
735 
736 /*!
737  Returns the set of properties created by this manager.
738 
739  \sa addProperty()
740 */
741 QSet<QtProperty*> QtAbstractPropertyManager::properties() const
742 {
743  return d_ptr->m_properties;
744 }
745 
746 /*!
747  Returns whether the given \a property has a value.
748 
749  The default implementation of this function returns true.
750 
751  \sa QtProperty::hasValue()
752 */
754 {
755  Q_UNUSED(property)
756  return true;
757 }
758 
759 /*!
760  Returns an icon representing the current state of the given \a
761  property.
762 
763  The default implementation of this function returns an invalid
764  icon.
765 
766  \sa QtProperty::valueIcon()
767 */
769 {
770  Q_UNUSED(property)
771  return QIcon();
772 }
773 
774 /*!
775  Returns a string representing the current state of the given \a
776  property.
777 
778  The default implementation of this function returns an empty
779  string.
780 
781  \sa QtProperty::valueText()
782 */
783 QString QtAbstractPropertyManager::valueText(const QtProperty* property) const
784 {
785  Q_UNUSED(property)
786  return QString();
787 }
788 
789 /*!
790  Returns a string representing the current state of the given \a
791  property.
792 
793  The default implementation of this function returns an empty
794  string.
795 
796  \sa QtProperty::valueText()
797 */
799 {
800  Q_UNUSED(property)
801  return QString();
802 }
803 
804 /*!
805  Returns the echo mode representing the current state of the given \a
806  property.
807 
808  The default implementation of this function returns QLineEdit::Normal.
809 
810  \sa QtProperty::valueText()
811 */
813 {
814  Q_UNUSED(property)
815  return QLineEdit::Normal;
816 }
817 
818 /*!
819  Creates a property with the given \a name which then is owned by this manager.
820 
821  Internally, this function calls the createProperty() and
822  initializeProperty() functions.
823 
824  \sa initializeProperty(), properties()
825 */
827 {
828  QtProperty* property = createProperty();
829 
830  if (property)
831  {
832  property->setPropertyName(name);
833  d_ptr->m_properties.insert(property);
834  initializeProperty(property);
835  }
836 
837  return property;
838 }
839 
840 /*!
841  Creates a property.
842 
843  The base implementation produce QtProperty instances; Reimplement
844  this function to make this manager produce objects of a QtProperty
845  subclass.
846 
847  \sa addProperty(), initializeProperty()
848 */
850 {
851  return new QtProperty(this);
852 }
853 
854 /*!
855  \fn void QtAbstractPropertyManager::initializeProperty(QtProperty *property) = 0
856 
857  This function is called whenever a new valid property pointer has
858  been created, passing the pointer as parameter.
859 
860  The purpose is to let the manager know that the \a property has
861  been created so that it can provide additional attributes for the
862  new property, e.g. QtIntPropertyManager adds \l
863  {QtIntPropertyManager::value()}{value}, \l
864  {QtIntPropertyManager::minimum()}{minimum} and \l
865  {QtIntPropertyManager::maximum()}{maximum} attributes. Since each manager
866  subclass adds type specific attributes, this function is pure
867  virtual and must be reimplemented when deriving from the
868  QtAbstractPropertyManager class.
869 
870  \sa addProperty(), createProperty()
871 */
872 
873 /*!
874  This function is called just before the specified \a property is destroyed.
875 
876  The purpose is to let the property manager know that the \a
877  property is being destroyed so that it can remove the property's
878  additional attributes.
879 
880  \sa clear(), propertyDestroyed()
881 */
883 {
884  Q_UNUSED(property)
885 }
886 
887 ////////////////////////////////////
888 
889 /*!
890  \class QtAbstractEditorFactoryBase
891 
892  \brief The QtAbstractEditorFactoryBase provides an interface for
893  editor factories.
894 
895  An editor factory is a class that is able to create an editing
896  widget of a specified type (e.g. line edits or comboboxes) for a
897  given QtProperty object, and it is used in conjunction with the
898  QtAbstractPropertyManager and QtAbstractPropertyBrowser classes.
899 
900  When using a property browser widget, the properties are created
901  and managed by implementations of the QtAbstractPropertyManager
902  class. To ensure that the properties' values will be displayed
903  using suitable editing widgets, the managers are associated with
904  objects of QtAbstractEditorFactory subclasses. The property browser
905  will use these associations to determine which factories it should
906  use to create the preferred editing widgets.
907 
908  Typically, an editor factory is created by subclassing the
909  QtAbstractEditorFactory template class which inherits
910  QtAbstractEditorFactoryBase. But note that several ready-made
911  implementations are available:
912 
913  \list
914  \o QtCheckBoxFactory
915  \o QtDateEditFactory
916  \o QtDateTimeEditFactory
917  \o QtDoubleSpinBoxFactory
918  \o QtEnumEditorFactory
919  \o QtLineEditFactory
920  \o QtScrollBarFactory
921  \o QtSliderFactory
922  \o QtSpinBoxFactory
923  \o QtTimeEditFactory
924  \o QtVariantEditorFactory
925  \endlist
926 
927  \sa QtAbstractPropertyManager, QtAbstractPropertyBrowser
928 */
929 
930 /*!
931  \fn virtual QWidget *QtAbstractEditorFactoryBase::createEditor(QtProperty *property,
932  QWidget *parent) = 0
933 
934  Creates an editing widget (with the given \a parent) for the given
935  \a property.
936 
937  This function is reimplemented in QtAbstractEditorFactory template class
938  which also provides a pure virtual convenience overload of this
939  function enabling access to the property's manager.
940 
941  \sa QtAbstractEditorFactory::createEditor()
942 */
943 
944 /*!
945  \fn QtAbstractEditorFactoryBase::QtAbstractEditorFactoryBase(QObject *parent = 0)
946 
947  Creates an abstract editor factory with the given \a parent.
948 */
949 
950 /*!
951  \fn virtual void QtAbstractEditorFactoryBase::breakConnection(QtAbstractPropertyManager *manager) = 0
952 
953  \internal
954 
955  Detaches property manager from factory.
956  This method is reimplemented in QtAbstractEditorFactory template subclass.
957  You don't need to reimplement it in your subclasses. Instead implement more convenient
958  QtAbstractEditorFactory::disconnectPropertyManager() which gives you access to particular manager subclass.
959 */
960 
961 /*!
962  \fn virtual void QtAbstractEditorFactoryBase::managerDestroyed(QObject *manager) = 0
963 
964  \internal
965 
966  This method is called when property manager is being destroyed.
967  Basically it notifies factory not to produce editors for properties owned by \a manager.
968  You don't need to reimplement it in your subclass. This method is implemented in
969  QtAbstractEditorFactory template subclass.
970 */
971 
972 /*!
973  \class QtAbstractEditorFactory
974 
975  \brief The QtAbstractEditorFactory is the base template class for editor
976  factories.
977 
978  An editor factory is a class that is able to create an editing
979  widget of a specified type (e.g. line edits or comboboxes) for a
980  given QtProperty object, and it is used in conjunction with the
981  QtAbstractPropertyManager and QtAbstractPropertyBrowser classes.
982 
983  Note that the QtAbstractEditorFactory functions are using the
984  PropertyManager template argument class which can be any
985  QtAbstractPropertyManager subclass. For example:
986 
987  \code
988  QtSpinBoxFactory *factory;
989  QSet<QtIntPropertyManager *> managers = factory->propertyManagers();
990  \endcode
991 
992  Note that QtSpinBoxFactory by definition creates editing widgets
993  \e only for properties created by QtIntPropertyManager.
994 
995  When using a property browser widget, the properties are created
996  and managed by implementations of the QtAbstractPropertyManager
997  class. To ensure that the properties' values will be displayed
998  using suitable editing widgets, the managers are associated with
999  objects of QtAbstractEditorFactory subclasses. The property browser will
1000  use these associations to determine which factories it should use
1001  to create the preferred editing widgets.
1002 
1003  A QtAbstractEditorFactory object is capable of producing editors for
1004  several property managers at the same time. To create an
1005  association between this factory and a given manager, use the
1006  addPropertyManager() function. Use the removePropertyManager() function to make
1007  this factory stop producing editors for a given property
1008  manager. Use the propertyManagers() function to retrieve the set of
1009  managers currently associated with this factory.
1010 
1011  Several ready-made implementations of the QtAbstractEditorFactory class
1012  are available:
1013 
1014  \list
1015  \o QtCheckBoxFactory
1016  \o QtDateEditFactory
1017  \o QtDateTimeEditFactory
1018  \o QtDoubleSpinBoxFactory
1019  \o QtEnumEditorFactory
1020  \o QtLineEditFactory
1021  \o QtScrollBarFactory
1022  \o QtSliderFactory
1023  \o QtSpinBoxFactory
1024  \o QtTimeEditFactory
1025  \o QtVariantEditorFactory
1026  \endlist
1027 
1028  When deriving from the QtAbstractEditorFactory class, several pure virtual
1029  functions must be implemented: the connectPropertyManager() function is
1030  used by the factory to connect to the given manager's signals, the
1031  createEditor() function is supposed to create an editor for the
1032  given property controlled by the given manager, and finally the
1033  disconnectPropertyManager() function is used by the factory to disconnect
1034  from the specified manager's signals.
1035 
1036  \sa QtAbstractEditorFactoryBase, QtAbstractPropertyManager
1037 */
1038 
1039 /*!
1040  \fn QtAbstractEditorFactory::QtAbstractEditorFactory(QObject *parent = 0)
1041 
1042  Creates an editor factory with the given \a parent.
1043 
1044  \sa addPropertyManager()
1045 */
1046 
1047 /*!
1048  \fn QWidget *QtAbstractEditorFactory::createEditor(QtProperty *property, QWidget *parent)
1049 
1050  Creates an editing widget (with the given \a parent) for the given
1051  \a property.
1052 */
1053 
1054 /*!
1055  \fn void QtAbstractEditorFactory::addPropertyManager(PropertyManager *manager)
1056 
1057  Adds the given \a manager to this factory's set of managers,
1058  making this factory produce editing widgets for properties created
1059  by the given manager.
1060 
1061  The PropertyManager type is a template argument class, and represents the chosen
1062  QtAbstractPropertyManager subclass.
1063 
1064  \sa propertyManagers(), removePropertyManager()
1065 */
1066 
1067 /*!
1068  \fn void QtAbstractEditorFactory::removePropertyManager(PropertyManager *manager)
1069 
1070  Removes the given \a manager from this factory's set of
1071  managers. The PropertyManager type is a template argument class, and may be
1072  any QtAbstractPropertyManager subclass.
1073 
1074  \sa propertyManagers(), addPropertyManager()
1075 */
1076 
1077 /*!
1078  \fn virtual void QtAbstractEditorFactory::connectPropertyManager(PropertyManager *manager) = 0
1079 
1080  Connects this factory to the given \a manager's signals. The
1081  PropertyManager type is a template argument class, and represents
1082  the chosen QtAbstractPropertyManager subclass.
1083 
1084  This function is used internally by the addPropertyManager() function, and
1085  makes it possible to update an editing widget when the associated
1086  property's data changes. This is typically done in custom slots
1087  responding to the signals emitted by the property's manager,
1088  e.g. QtIntPropertyManager::valueChanged() and
1089  QtIntPropertyManager::rangeChanged().
1090 
1091  \sa propertyManagers(), disconnectPropertyManager()
1092 */
1093 
1094 /*!
1095  \fn virtual QWidget *QtAbstractEditorFactory::createEditor(PropertyManager *manager, QtProperty *property,
1096  QWidget *parent) = 0
1097 
1098  Creates an editing widget with the given \a parent for the
1099  specified \a property created by the given \a manager. The
1100  PropertyManager type is a template argument class, and represents
1101  the chosen QtAbstractPropertyManager subclass.
1102 
1103  This function must be implemented in derived classes: It is
1104  recommended to store a pointer to the widget and map it to the
1105  given \a property, since the widget must be updated whenever the
1106  associated property's data changes. This is typically done in
1107  custom slots responding to the signals emitted by the property's
1108  manager, e.g. QtIntPropertyManager::valueChanged() and
1109  QtIntPropertyManager::rangeChanged().
1110 
1111  \sa connectPropertyManager()
1112 */
1113 
1114 /*!
1115  \fn virtual void QtAbstractEditorFactory::disconnectPropertyManager(PropertyManager *manager) = 0
1116 
1117  Disconnects this factory from the given \a manager's signals. The
1118  PropertyManager type is a template argument class, and represents
1119  the chosen QtAbstractPropertyManager subclass.
1120 
1121  This function is used internally by the removePropertyManager() function.
1122 
1123  \sa propertyManagers(), connectPropertyManager()
1124 */
1125 
1126 /*!
1127  \fn QSet<PropertyManager *> QtAbstractEditorFactory::propertyManagers() const
1128 
1129  Returns the factory's set of associated managers. The
1130  PropertyManager type is a template argument class, and represents
1131  the chosen QtAbstractPropertyManager subclass.
1132 
1133  \sa addPropertyManager(), removePropertyManager()
1134 */
1135 
1136 /*!
1137  \fn PropertyManager *QtAbstractEditorFactory::propertyManager(QtProperty *property) const
1138 
1139  Returns the property manager for the given \a property, or 0 if
1140  the given \a property doesn't belong to any of this factory's
1141  registered managers.
1142 
1143  The PropertyManager type is a template argument class, and represents the chosen
1144  QtAbstractPropertyManager subclass.
1145 
1146  \sa propertyManagers()
1147 */
1148 
1149 /*!
1150  \fn virtual void QtAbstractEditorFactory::managerDestroyed(QObject *manager)
1151 
1152  \internal
1153  \reimp
1154 */
1155 
1156 ////////////////////////////////////
1158 {
1159 public:
1161  : m_browser(browser), m_property(property), m_parent(parent), q_ptr(0) {}
1162 
1163  void addChild(QtBrowserItem* index, QtBrowserItem* after);
1165 
1169 
1171 
1172  QList<QtBrowserItem*> m_children;
1173 
1174 };
1175 
1177 {
1178  if (m_children.contains(index))
1179  {
1180  return;
1181  }
1182 
1183  int idx = m_children.indexOf(after) + 1; // we insert after returned idx, if it was -1 then we set idx to 0;
1184  m_children.insert(idx, index);
1185 }
1186 
1188 {
1189  m_children.removeAll(index);
1190 }
1191 
1192 
1193 /*!
1194  \class QtBrowserItem
1195 
1196  \brief The QtBrowserItem class represents a property in
1197  a property browser instance.
1198 
1199  Browser items are created whenever a QtProperty is inserted to the
1200  property browser. A QtBrowserItem uniquely identifies a
1201  browser's item. Thus, if the same QtProperty is inserted multiple
1202  times, each occurrence gets its own unique QtBrowserItem. The
1203  items are owned by QtAbstractPropertyBrowser and automatically
1204  deleted when they are removed from the browser.
1205 
1206  You can traverse a browser's properties by calling parent() and
1207  children(). The property and the browser associated with an item
1208  are available as property() and browser().
1209 
1210  \sa QtAbstractPropertyBrowser, QtProperty
1211 */
1212 
1213 /*!
1214  Returns the property which is accosiated with this item. Note that
1215  several items can be associated with the same property instance in
1216  the same property browser.
1217 
1218  \sa QtAbstractPropertyBrowser::items()
1219 */
1220 
1222 {
1223  return d_ptr->m_property;
1224 }
1225 
1226 /*!
1227  Returns the parent item of \e this item. Returns 0 if \e this item
1228  is associated with top-level property in item's property browser.
1229 
1230  \sa children()
1231 */
1232 
1234 {
1235  return d_ptr->m_parent;
1236 }
1237 
1238 /*!
1239  Returns the children items of \e this item. The properties
1240  reproduced from children items are always the same as
1241  reproduced from associated property' children, for example:
1242 
1243  \code
1244  QtBrowserItem *item;
1245  QList<QtBrowserItem *> childrenItems = item->children();
1246 
1247  QList<QtProperty *> childrenProperties = item->property()->subProperties();
1248  \endcode
1249 
1250  The \e childrenItems list represents the same list as \e childrenProperties.
1251 */
1252 
1253 QList<QtBrowserItem*> QtBrowserItem::children() const
1254 {
1255  return d_ptr->m_children;
1256 }
1257 
1258 /*!
1259  Returns the property browser which owns \e this item.
1260 */
1261 
1263 {
1264  return d_ptr->m_browser;
1265 }
1266 
1267 QtBrowserItem::QtBrowserItem(QtAbstractPropertyBrowser* browser, QtProperty* property, QtBrowserItem* parent)
1268 {
1270  d_ptr->q_ptr = this;
1271 }
1272 
1273 QtBrowserItem::~QtBrowserItem()
1274 {
1275  delete d_ptr;
1276 }
1277 
1278 
1279 ////////////////////////////////////
1280 
1281 typedef QMap < QtAbstractPropertyBrowser*, QMap < QtAbstractPropertyManager*,
1284  QList<QtAbstractPropertyBrowser*> > > Map2;
1285 Q_GLOBAL_STATIC(Map1, m_viewToManagerToFactory)
1286 Q_GLOBAL_STATIC(Map2, m_managerToFactoryToViews)
1287 
1289 {
1291  Q_DECLARE_PUBLIC(QtAbstractPropertyBrowser)
1292 public:
1294 
1295  void insertSubTree(QtProperty* property,
1296  QtProperty* parentProperty);
1297  void removeSubTree(QtProperty* property,
1298  QtProperty* parentProperty);
1299  void createBrowserIndexes(QtProperty* property, QtProperty* parentProperty, QtProperty* afterProperty);
1300  void removeBrowserIndexes(QtProperty* property, QtProperty* parentProperty);
1301  QtBrowserItem* createBrowserIndex(QtProperty* property, QtBrowserItem* parentIndex, QtBrowserItem* afterIndex);
1302  void removeBrowserIndex(QtBrowserItem* index);
1303  void clearIndex(QtBrowserItem* index);
1304 
1305  void slotPropertyInserted(QtProperty* property,
1306  QtProperty* parentProperty, QtProperty* afterProperty);
1307  void slotPropertyRemoved(QtProperty* property, QtProperty* parentProperty);
1308  void slotPropertyDestroyed(QtProperty* property);
1309  void slotPropertyDataChanged(QtProperty* property);
1310 
1311  QList<QtProperty*> m_subItems;
1312  QMap<QtAbstractPropertyManager*, QList<QtProperty*> > m_managerToProperties;
1313  QMap<QtProperty*, QList<QtProperty*> > m_propertyToParents;
1314 
1315  QMap<QtProperty*, QtBrowserItem*> m_topLevelPropertyToIndex;
1316  QList<QtBrowserItem*> m_topLevelIndexes;
1317  QMap<QtProperty*, QList<QtBrowserItem*> > m_propertyToIndexes;
1318 
1320 };
1321 
1323  m_currentItem(0)
1324 {
1325 }
1326 
1328  QtProperty* parentProperty)
1329 {
1330  if (m_propertyToParents.contains(property))
1331  {
1332  // property was already inserted, so its manager is connected
1333  // and all its children are inserted and theirs managers are connected
1334  // we just register new parent (parent has to be new).
1335  m_propertyToParents[property].append(parentProperty);
1336  // don't need to update m_managerToProperties map since
1337  // m_managerToProperties[manager] already contains property.
1338  return;
1339  }
1340 
1341  QtAbstractPropertyManager* manager = property->propertyManager();
1342 
1343  if (m_managerToProperties[manager].isEmpty())
1344  {
1345  // connect manager's signals
1346  q_ptr->connect(manager, SIGNAL(propertyInserted(QtProperty*,
1347  QtProperty*, QtProperty*)),
1348  q_ptr, SLOT(slotPropertyInserted(QtProperty*,
1349  QtProperty*, QtProperty*)));
1350  q_ptr->connect(manager, SIGNAL(propertyRemoved(QtProperty*,
1351  QtProperty*)),
1352  q_ptr, SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1353  q_ptr->connect(manager, SIGNAL(propertyDestroyed(QtProperty*)),
1354  q_ptr, SLOT(slotPropertyDestroyed(QtProperty*)));
1355  q_ptr->connect(manager, SIGNAL(propertyChanged(QtProperty*)),
1356  q_ptr, SLOT(slotPropertyDataChanged(QtProperty*)));
1357  }
1358 
1359  m_managerToProperties[manager].append(property);
1360  m_propertyToParents[property].append(parentProperty);
1361 
1362  QList<QtProperty*> subList = property->subProperties();
1363  QListIterator<QtProperty*> itSub(subList);
1364 
1365  while (itSub.hasNext())
1366  {
1367  QtProperty* subProperty = itSub.next();
1368  insertSubTree(subProperty, property);
1369  }
1370 }
1371 
1373  QtProperty* parentProperty)
1374 {
1375  if (!m_propertyToParents.contains(property))
1376  {
1377  // ASSERT
1378  return;
1379  }
1380 
1381  m_propertyToParents[property].removeAll(parentProperty);
1382 
1383  if (!m_propertyToParents[property].isEmpty())
1384  {
1385  return;
1386  }
1387 
1388  m_propertyToParents.remove(property);
1389  QtAbstractPropertyManager* manager = property->propertyManager();
1390  m_managerToProperties[manager].removeAll(property);
1391 
1392  if (m_managerToProperties[manager].isEmpty())
1393  {
1394  // disconnect manager's signals
1395  q_ptr->disconnect(manager, SIGNAL(propertyInserted(QtProperty*,
1396  QtProperty*, QtProperty*)),
1397  q_ptr, SLOT(slotPropertyInserted(QtProperty*,
1398  QtProperty*, QtProperty*)));
1399  q_ptr->disconnect(manager, SIGNAL(propertyRemoved(QtProperty*,
1400  QtProperty*)),
1401  q_ptr, SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1402  q_ptr->disconnect(manager, SIGNAL(propertyDestroyed(QtProperty*)),
1403  q_ptr, SLOT(slotPropertyDestroyed(QtProperty*)));
1404  q_ptr->disconnect(manager, SIGNAL(propertyChanged(QtProperty*)),
1405  q_ptr, SLOT(slotPropertyDataChanged(QtProperty*)));
1406 
1407  m_managerToProperties.remove(manager);
1408  }
1409 
1410  QList<QtProperty*> subList = property->subProperties();
1411  QListIterator<QtProperty*> itSub(subList);
1412 
1413  while (itSub.hasNext())
1414  {
1415  QtProperty* subProperty = itSub.next();
1416  removeSubTree(subProperty, property);
1417  }
1418 }
1419 
1421 {
1422  QMap<QtBrowserItem*, QtBrowserItem*> parentToAfter;
1423 
1424  if (afterProperty)
1425  {
1426  QMap<QtProperty*, QList<QtBrowserItem*> >::ConstIterator it =
1427  m_propertyToIndexes.find(afterProperty);
1428 
1429  if (it == m_propertyToIndexes.constEnd())
1430  {
1431  return;
1432  }
1433 
1434  QList<QtBrowserItem*> indexes = it.value();
1435  QListIterator<QtBrowserItem*> itIndex(indexes);
1436 
1437  while (itIndex.hasNext())
1438  {
1439  QtBrowserItem* idx = itIndex.next();
1440  QtBrowserItem* parentIdx = idx->parent();
1441 
1442  if ((parentProperty && parentIdx && parentIdx->property() == parentProperty) || (!parentProperty && !parentIdx))
1443  {
1444  parentToAfter[idx->parent()] = idx;
1445  }
1446  }
1447  }
1448  else if (parentProperty)
1449  {
1450  QMap<QtProperty*, QList<QtBrowserItem*> >::ConstIterator it =
1451  m_propertyToIndexes.find(parentProperty);
1452 
1453  if (it == m_propertyToIndexes.constEnd())
1454  {
1455  return;
1456  }
1457 
1458  QList<QtBrowserItem*> indexes = it.value();
1459  QListIterator<QtBrowserItem*> itIndex(indexes);
1460 
1461  while (itIndex.hasNext())
1462  {
1463  QtBrowserItem* idx = itIndex.next();
1464  parentToAfter[idx] = 0;
1465  }
1466  }
1467  else
1468  {
1469  parentToAfter[0] = 0;
1470  }
1471 
1472  const QMap<QtBrowserItem*, QtBrowserItem*>::ConstIterator pcend = parentToAfter.constEnd();
1473 
1474  for (QMap<QtBrowserItem*, QtBrowserItem*>::ConstIterator it = parentToAfter.constBegin(); it != pcend; ++it)
1475  {
1476  createBrowserIndex(property, it.key(), it.value());
1477  }
1478 }
1479 
1481  QtBrowserItem* parentIndex, QtBrowserItem* afterIndex)
1482 {
1483  QtBrowserItem* newIndex = new QtBrowserItem(q_ptr, property, parentIndex);
1484 
1485  if (parentIndex)
1486  {
1487  parentIndex->d_ptr->addChild(newIndex, afterIndex);
1488  }
1489  else
1490  {
1491  m_topLevelPropertyToIndex[property] = newIndex;
1492  m_topLevelIndexes.insert(m_topLevelIndexes.indexOf(afterIndex) + 1, newIndex);
1493  }
1494 
1495  m_propertyToIndexes[property].append(newIndex);
1496 
1497  q_ptr->itemInserted(newIndex, afterIndex);
1498 
1499  QList<QtProperty*> subItems = property->subProperties();
1500  QListIterator<QtProperty*> itChild(subItems);
1501  QtBrowserItem* afterChild = 0;
1502 
1503  while (itChild.hasNext())
1504  {
1505  QtProperty* child = itChild.next();
1506  afterChild = createBrowserIndex(child, newIndex, afterChild);
1507  }
1508 
1509  return newIndex;
1510 }
1511 
1513 {
1514  QList<QtBrowserItem*> toRemove;
1515  QMap<QtProperty*, QList<QtBrowserItem*> >::ConstIterator it =
1516  m_propertyToIndexes.find(property);
1517 
1518  if (it == m_propertyToIndexes.constEnd())
1519  {
1520  return;
1521  }
1522 
1523  QList<QtBrowserItem*> indexes = it.value();
1524  QListIterator<QtBrowserItem*> itIndex(indexes);
1525 
1526  while (itIndex.hasNext())
1527  {
1528  QtBrowserItem* idx = itIndex.next();
1529  QtBrowserItem* parentIdx = idx->parent();
1530 
1531  if ((parentProperty && parentIdx && parentIdx->property() == parentProperty) || (!parentProperty && !parentIdx))
1532  {
1533  toRemove.append(idx);
1534  }
1535  }
1536 
1537  QListIterator<QtBrowserItem*> itRemove(toRemove);
1538 
1539  while (itRemove.hasNext())
1540  {
1541  QtBrowserItem* index = itRemove.next();
1543  }
1544 }
1545 
1547 {
1548  QList<QtBrowserItem*> children = index->children();
1549 
1550  for (int i = children.count(); i > 0; i--)
1551  {
1552  removeBrowserIndex(children.at(i - 1));
1553  }
1554 
1555  q_ptr->itemRemoved(index);
1556 
1557  if (index->parent())
1558  {
1559  index->parent()->d_ptr->removeChild(index);
1560  }
1561  else
1562  {
1563  m_topLevelPropertyToIndex.remove(index->property());
1564  m_topLevelIndexes.removeAll(index);
1565  }
1566 
1567  QtProperty* property = index->property();
1568 
1569  m_propertyToIndexes[property].removeAll(index);
1570 
1571  if (m_propertyToIndexes[property].isEmpty())
1572  {
1573  m_propertyToIndexes.remove(property);
1574  }
1575 
1576  delete index;
1577 }
1578 
1580 {
1581  QList<QtBrowserItem*> children = index->children();
1582  QListIterator<QtBrowserItem*> itChild(children);
1583 
1584  while (itChild.hasNext())
1585  {
1586  clearIndex(itChild.next());
1587  }
1588 
1589  delete index;
1590 }
1591 
1593  QtProperty* parentProperty, QtProperty* afterProperty)
1594 {
1595  if (!m_propertyToParents.contains(parentProperty))
1596  {
1597  return;
1598  }
1599 
1600  createBrowserIndexes(property, parentProperty, afterProperty);
1601  insertSubTree(property, parentProperty);
1602  //q_ptr->propertyInserted(property, parentProperty, afterProperty);
1603 }
1604 
1606  QtProperty* parentProperty)
1607 {
1608  if (!m_propertyToParents.contains(parentProperty))
1609  {
1610  return;
1611  }
1612 
1613  removeSubTree(property, parentProperty); // this line should be probably moved down after propertyRemoved call
1614  //q_ptr->propertyRemoved(property, parentProperty);
1615  removeBrowserIndexes(property, parentProperty);
1616 }
1617 
1619 {
1620  if (!m_subItems.contains(property))
1621  {
1622  return;
1623  }
1624 
1625  q_ptr->removeProperty(property);
1626 }
1627 
1629 {
1630  if (!m_propertyToParents.contains(property))
1631  {
1632  return;
1633  }
1634 
1635  QMap<QtProperty*, QList<QtBrowserItem*> >::ConstIterator it =
1636  m_propertyToIndexes.find(property);
1637 
1638  if (it == m_propertyToIndexes.constEnd())
1639  {
1640  return;
1641  }
1642 
1643  QList<QtBrowserItem*> indexes = it.value();
1644  QListIterator<QtBrowserItem*> itIndex(indexes);
1645 
1646  while (itIndex.hasNext())
1647  {
1648  QtBrowserItem* idx = itIndex.next();
1649  q_ptr->itemChanged(idx);
1650  }
1651 
1652  //q_ptr->propertyChanged(property);
1653 }
1654 
1655 /*!
1656  \class QtAbstractPropertyBrowser
1657 
1658  \brief QtAbstractPropertyBrowser provides a base class for
1659  implementing property browsers.
1660 
1661  A property browser is a widget that enables the user to edit a
1662  given set of properties. Each property is represented by a label
1663  specifying the property's name, and an editing widget (e.g. a line
1664  edit or a combobox) holding its value. A property can have zero or
1665  more subproperties.
1666 
1667  \image qtpropertybrowser.png
1668 
1669  The top level properties can be retrieved using the
1670  properties() function. To traverse each property's
1671  subproperties, use the QtProperty::subProperties() function. In
1672  addition, the set of top level properties can be manipulated using
1673  the addProperty(), insertProperty() and removeProperty()
1674  functions. Note that the QtProperty class provides a corresponding
1675  set of functions making it possible to manipulate the set of
1676  subproperties as well.
1677 
1678  To remove all the properties from the property browser widget, use
1679  the clear() function. This function will clear the editor, but it
1680  will not delete the properties since they can still be used in
1681  other editors.
1682 
1683  The properties themselves are created and managed by
1684  implementations of the QtAbstractPropertyManager class. A manager
1685  can handle (i.e. create and manage) properties of a given type. In
1686  the property browser the managers are associated with
1687  implementations of the QtAbstractEditorFactory: A factory is a
1688  class able to create an editing widget of a specified type.
1689 
1690  When using a property browser widget, managers must be created for
1691  each of the required property types before the properties
1692  themselves can be created. To ensure that the properties' values
1693  will be displayed using suitable editing widgets, the managers
1694  must be associated with objects of the preferred factory
1695  implementations using the setFactoryForManager() function. The
1696  property browser will use these associations to determine which
1697  factory it should use to create the preferred editing widget.
1698 
1699  Note that a factory can be associated with many managers, but a
1700  manager can only be associated with one single factory within the
1701  context of a single property browser. The associations between
1702  managers and factories can at any time be removed using the
1703  unsetFactoryForManager() function.
1704 
1705  Whenever the property data changes or a property is inserted or
1706  removed, the itemChanged(), itemInserted() or
1707  itemRemoved() functions are called, respectively. These
1708  functions must be reimplemented in derived classes in order to
1709  update the property browser widget. Be aware that some property
1710  instances can appear several times in an abstract tree
1711  structure. For example:
1712 
1713  \table 100%
1714  \row
1715  \o
1716  \code
1717  QtProperty *property1, *property2, *property3;
1718 
1719  property2->addSubProperty(property1);
1720  property3->addSubProperty(property2);
1721 
1722  QtAbstractPropertyBrowser *editor;
1723 
1724  editor->addProperty(property1);
1725  editor->addProperty(property2);
1726  editor->addProperty(property3);
1727  \endcode
1728  \o \image qtpropertybrowser-duplicate.png
1729  \endtable
1730 
1731  The addProperty() function returns a QtBrowserItem that uniquely
1732  identifies the created item.
1733 
1734  To make a property editable in the property browser, the
1735  createEditor() function must be called to provide the
1736  property with a suitable editing widget.
1737 
1738  Note that there are two ready-made property browser
1739  implementations:
1740 
1741  \list
1742  \o QtGroupBoxPropertyBrowser
1743  \o QtTreePropertyBrowser
1744  \endlist
1745 
1746  \sa QtAbstractPropertyManager, QtAbstractEditorFactoryBase
1747 */
1748 
1749 /*!
1750  \fn void QtAbstractPropertyBrowser::setFactoryForManager(PropertyManager *manager,
1751  QtAbstractEditorFactory<PropertyManager> *factory)
1752 
1753  Connects the given \a manager to the given \a factory, ensuring
1754  that properties of the \a manager's type will be displayed with an
1755  editing widget suitable for their value.
1756 
1757  For example:
1758 
1759  \code
1760  QtIntPropertyManager *intManager;
1761  QtDoublePropertyManager *doubleManager;
1762 
1763  QtProperty *myInteger = intManager->addProperty();
1764  QtProperty *myDouble = doubleManager->addProperty();
1765 
1766  QtSpinBoxFactory *spinBoxFactory;
1767  QtDoubleSpinBoxFactory *doubleSpinBoxFactory;
1768 
1769  QtAbstractPropertyBrowser *editor;
1770  editor->setFactoryForManager(intManager, spinBoxFactory);
1771  editor->setFactoryForManager(doubleManager, doubleSpinBoxFactory);
1772 
1773  editor->addProperty(myInteger);
1774  editor->addProperty(myDouble);
1775  \endcode
1776 
1777  In this example the \c myInteger property's value is displayed
1778  with a QSpinBox widget, while the \c myDouble property's value is
1779  displayed with a QDoubleSpinBox widget.
1780 
1781  Note that a factory can be associated with many managers, but a
1782  manager can only be associated with one single factory. If the
1783  given \a manager already is associated with another factory, the
1784  old association is broken before the new one established.
1785 
1786  This function ensures that the given \a manager and the given \a
1787  factory are compatible, and it automatically calls the
1788  QtAbstractEditorFactory::addPropertyManager() function if necessary.
1789 
1790  \sa unsetFactoryForManager()
1791 */
1792 
1793 /*!
1794  \fn virtual void QtAbstractPropertyBrowser::itemInserted(QtBrowserItem *insertedItem,
1795  QtBrowserItem *precedingItem) = 0
1796 
1797  This function is called to update the widget whenever a property
1798  is inserted or added to the property browser, passing pointers to
1799  the \a insertedItem of property and the specified
1800  \a precedingItem as parameters.
1801 
1802  If \a precedingItem is 0, the \a insertedItem was put at
1803  the beginning of its parent item's list of subproperties. If
1804  the parent of \a insertedItem is 0, the \a insertedItem was added as a top
1805  level property of \e this property browser.
1806 
1807  This function must be reimplemented in derived classes. Note that
1808  if the \a insertedItem's property has subproperties, this
1809  method will be called for those properties as soon as the current call is finished.
1810 
1811  \sa insertProperty(), addProperty()
1812 */
1813 
1814 /*!
1815  \fn virtual void QtAbstractPropertyBrowser::itemRemoved(QtBrowserItem *item) = 0
1816 
1817  This function is called to update the widget whenever a property
1818  is removed from the property browser, passing the pointer to the
1819  \a item of the property as parameters. The passed \a item is
1820  deleted just after this call is finished.
1821 
1822  If the the parent of \a item is 0, the removed \a item was a
1823  top level property in this editor.
1824 
1825  This function must be reimplemented in derived classes. Note that
1826  if the removed \a item's property has subproperties, this
1827  method will be called for those properties just before the current call is started.
1828 
1829  \sa removeProperty()
1830 */
1831 
1832 /*!
1833  \fn virtual void QtAbstractPropertyBrowser::itemChanged(QtBrowserItem *item) = 0
1834 
1835  This function is called whenever a property's data changes,
1836  passing a pointer to the \a item of property as parameter.
1837 
1838  This function must be reimplemented in derived classes in order to
1839  update the property browser widget whenever a property's name,
1840  tool tip, status tip, "what's this" text, value text or value icon
1841  changes.
1842 
1843  Note that if the property browser contains several occurrences of
1844  the same property, this method will be called once for each
1845  occurrence (with a different item each time).
1846 
1847  \sa QtProperty, items()
1848 */
1849 
1850 /*!
1851  Creates an abstract property browser with the given \a parent.
1852 */
1854  : QWidget(parent)
1855 {
1857  d_ptr->q_ptr = this;
1858 
1859 }
1860 
1861 /*!
1862  Destroys the property browser, and destroys all the items that were
1863  created by this property browser.
1864 
1865  Note that the properties that were displayed in the editor are not
1866  deleted since they still can be used in other editors. Neither
1867  does the destructor delete the property managers and editor
1868  factories that were used by this property browser widget unless
1869  this widget was their parent.
1870 
1871  \sa QtAbstractPropertyManager::~QtAbstractPropertyManager()
1872 */
1874 {
1875  QList<QtBrowserItem*> indexes = topLevelItems();
1876  QListIterator<QtBrowserItem*> itItem(indexes);
1877 
1878  while (itItem.hasNext())
1879  {
1880  d_ptr->clearIndex(itItem.next());
1881  }
1882 
1883  delete d_ptr;
1884 }
1885 
1886 /*!
1887  Returns the property browser's list of top level properties.
1888 
1889  To traverse the subproperties, use the QtProperty::subProperties()
1890  function.
1891 
1892  \sa addProperty(), insertProperty(), removeProperty()
1893 */
1894 QList<QtProperty*> QtAbstractPropertyBrowser::properties() const
1895 {
1896  return d_ptr->m_subItems;
1897 }
1898 
1899 /*!
1900  Returns the property browser's list of all items associated
1901  with the given \a property.
1902 
1903  There is one item per instance of the property in the browser.
1904 
1905  \sa topLevelItem()
1906 */
1907 
1908 QList<QtBrowserItem*> QtAbstractPropertyBrowser::items(QtProperty* property) const
1909 {
1910  return d_ptr->m_propertyToIndexes.value(property);
1911 }
1912 
1913 /*!
1914  Returns the top-level items associated with the given \a property.
1915 
1916  Returns 0 if \a property wasn't inserted into this property
1917  browser or isn't a top-level one.
1918 
1919  \sa topLevelItems(), items()
1920 */
1921 
1923 {
1924  return d_ptr->m_topLevelPropertyToIndex.value(property);
1925 }
1926 
1927 /*!
1928  Returns the list of top-level items.
1929 
1930  \sa topLevelItem()
1931 */
1932 
1933 QList<QtBrowserItem*> QtAbstractPropertyBrowser::topLevelItems() const
1934 {
1935  return d_ptr->m_topLevelIndexes;
1936 }
1937 
1938 /*!
1939  Removes all the properties from the editor, but does not delete
1940  them since they can still be used in other editors.
1941 
1942  \sa removeProperty(), QtAbstractPropertyManager::clear()
1943 */
1945 {
1946  QList<QtProperty*> subList = properties();
1947  QListIterator<QtProperty*> itSub(subList);
1948  itSub.toBack();
1949 
1950  while (itSub.hasPrevious())
1951  {
1952  QtProperty* property = itSub.previous();
1953  removeProperty(property);
1954  }
1955 }
1956 
1957 /*!
1958  Appends the given \a property (and its subproperties) to the
1959  property browser's list of top level properties. Returns the item
1960  created by property browser which is associated with the \a property.
1961  In order to get all children items created by the property
1962  browser in this call, the returned item should be traversed.
1963 
1964  If the specified \a property is already added, this function does
1965  nothing and returns 0.
1966 
1967  \sa insertProperty(), QtProperty::addSubProperty(), properties()
1968 */
1970 {
1971  QtProperty* afterProperty = 0;
1972 
1973  if (d_ptr->m_subItems.count() > 0)
1974  {
1975  afterProperty = d_ptr->m_subItems.last();
1976  }
1977 
1978  return insertProperty(property, afterProperty);
1979 }
1980 
1981 /*!
1982  \fn QtBrowserItem *QtAbstractPropertyBrowser::insertProperty(QtProperty *property,
1983  QtProperty *afterProperty)
1984 
1985  Inserts the given \a property (and its subproperties) after
1986  the specified \a afterProperty in the browser's list of top
1987  level properties. Returns item created by property browser which
1988  is associated with the \a property. In order to get all children items
1989  created by the property browser in this call returned item should be traversed.
1990 
1991  If the specified \a afterProperty is 0, the given \a property is
1992  inserted at the beginning of the list. If \a property is
1993  already inserted, this function does nothing and returns 0.
1994 
1995  \sa addProperty(), QtProperty::insertSubProperty(), properties()
1996 */
1998  QtProperty* afterProperty)
1999 {
2000  if (!property)
2001  {
2002  return 0;
2003  }
2004 
2005  // if item is already inserted in this item then cannot add.
2006  QList<QtProperty*> pendingList = properties();
2007  int pos = 0;
2008  int newPos = 0;
2009 
2010  while (pos < pendingList.count())
2011  {
2012  QtProperty* prop = pendingList.at(pos);
2013 
2014  if (prop == property)
2015  {
2016  return 0;
2017  }
2018 
2019  if (prop == afterProperty)
2020  {
2021  newPos = pos + 1;
2022  }
2023 
2024  pos++;
2025  }
2026 
2027  d_ptr->createBrowserIndexes(property, 0, afterProperty);
2028 
2029  // traverse inserted subtree and connect to manager's signals
2030  d_ptr->insertSubTree(property, 0);
2031 
2032  d_ptr->m_subItems.insert(newPos, property);
2033  //propertyInserted(property, 0, properAfterProperty);
2034  return topLevelItem(property);
2035 }
2036 
2037 /*!
2038  Removes the specified \a property (and its subproperties) from the
2039  property browser's list of top level properties. All items
2040  that were associated with the given \a property and its children
2041  are deleted.
2042 
2043  Note that the properties are \e not deleted since they can still
2044  be used in other editors.
2045 
2046  \sa clear(), QtProperty::removeSubProperty(), properties()
2047 */
2049 {
2050  if (!property)
2051  {
2052  return;
2053  }
2054 
2055  QList<QtProperty*> pendingList = properties();
2056  int pos = 0;
2057 
2058  while (pos < pendingList.count())
2059  {
2060  if (pendingList.at(pos) == property)
2061  {
2062  d_ptr->m_subItems.removeAt(pos); //perhaps this two lines
2063  d_ptr->removeSubTree(property, 0); //should be moved down after propertyRemoved call.
2064  //propertyRemoved(property, 0);
2065 
2066  d_ptr->removeBrowserIndexes(property, 0);
2067 
2068  // when item is deleted, item will call removeItem for top level items,
2069  // and itemRemoved for nested items.
2070 
2071  return;
2072  }
2073 
2074  pos++;
2075  }
2076 }
2077 
2078 /*!
2079  Creates an editing widget (with the given \a parent) for the given
2080  \a property according to the previously established associations
2081  between property managers and editor factories.
2082 
2083  If the property is created by a property manager which was not
2084  associated with any of the existing factories in \e this property
2085  editor, the function returns 0.
2086 
2087  To make a property editable in the property browser, the
2088  createEditor() function must be called to provide the
2089  property with a suitable editing widget.
2090 
2091  Reimplement this function to provide additional decoration for the
2092  editing widgets created by the installed factories.
2093 
2094  \sa setFactoryForManager()
2095 */
2097  QWidget* parent)
2098 {
2099  QtAbstractEditorFactoryBase* factory = 0;
2100  QtAbstractPropertyManager* manager = property->propertyManager();
2101 
2102  if (m_viewToManagerToFactory()->contains(this) &&
2103  (*m_viewToManagerToFactory())[this].contains(manager))
2104  {
2105  factory = (*m_viewToManagerToFactory())[this][manager];
2106  }
2107 
2108  if (!factory)
2109  {
2110  return 0;
2111  }
2112 
2113  return factory->createEditor(property, parent);
2114 }
2115 
2116 bool QtAbstractPropertyBrowser::addFactory(QtAbstractPropertyManager* abstractManager,
2117  QtAbstractEditorFactoryBase* abstractFactory)
2118 {
2119  bool connectNeeded = false;
2120 
2121  if (!m_managerToFactoryToViews()->contains(abstractManager) ||
2122  !(*m_managerToFactoryToViews())[abstractManager].contains(abstractFactory))
2123  {
2124  connectNeeded = true;
2125  }
2126  else if ((*m_managerToFactoryToViews())[abstractManager][abstractFactory]
2127  .contains(this))
2128  {
2129  return connectNeeded;
2130  }
2131 
2132  if (m_viewToManagerToFactory()->contains(this) &&
2133  (*m_viewToManagerToFactory())[this].contains(abstractManager))
2134  {
2135  unsetFactoryForManager(abstractManager);
2136  }
2137 
2138  (*m_managerToFactoryToViews())[abstractManager][abstractFactory].append(this);
2139  (*m_viewToManagerToFactory())[this][abstractManager] = abstractFactory;
2140 
2141  return connectNeeded;
2142 }
2143 
2144 /*!
2145  Removes the association between the given \a manager and the
2146  factory bound to it, automatically calling the
2147  QtAbstractEditorFactory::removePropertyManager() function if necessary.
2148 
2149  \sa setFactoryForManager()
2150 */
2152 {
2153  if (!m_viewToManagerToFactory()->contains(this) ||
2154  !(*m_viewToManagerToFactory())[this].contains(manager))
2155  {
2156  return;
2157  }
2158 
2159  QtAbstractEditorFactoryBase* abstractFactory =
2160  (*m_viewToManagerToFactory())[this][manager];
2161  (*m_viewToManagerToFactory())[this].remove(manager);
2162 
2163  if ((*m_viewToManagerToFactory())[this].isEmpty())
2164  {
2165  (*m_viewToManagerToFactory()).remove(this);
2166  }
2167 
2168  (*m_managerToFactoryToViews())[manager][abstractFactory].removeAll(this);
2169 
2170  if ((*m_managerToFactoryToViews())[manager][abstractFactory].isEmpty())
2171  {
2172  (*m_managerToFactoryToViews())[manager].remove(abstractFactory);
2173  abstractFactory->breakConnection(manager);
2174 
2175  if ((*m_managerToFactoryToViews())[manager].isEmpty())
2176  {
2177  (*m_managerToFactoryToViews()).remove(manager);
2178  }
2179  }
2180 }
2181 
2182 /*!
2183  Returns the current item in the property browser.
2184 
2185  \sa setCurrentItem()
2186 */
2188 {
2189  return d_ptr->m_currentItem;
2190 }
2191 
2192 /*!
2193  Sets the current item in the property browser to \a item.
2194 
2195  \sa currentItem(), currentItemChanged()
2196 */
2198 {
2199  QtBrowserItem* oldItem = d_ptr->m_currentItem;
2200  d_ptr->m_currentItem = item;
2201 
2202  if (oldItem != item)
2203  {
2204  emit currentItemChanged(item);
2205  }
2206 }
2207 
2208 QT_END_NAMESPACE
2209 
2210 #include "moc_qtpropertybrowser.cpp"
QtAbstractPropertyBrowser::itemInserted
virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem)=0
QtPropertyPrivate::m_whatsThis
QString m_whatsThis
Definition: qtpropertybrowser.cpp:106
QtPropertyPrivate::m_statusTip
QString m_statusTip
Definition: qtpropertybrowser.cpp:105
QtAbstractPropertyBrowser::addProperty
QtBrowserItem * addProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:1969
QtAbstractPropertyBrowserPrivate::m_propertyToParents
QMap< QtProperty *, QList< QtProperty * > > m_propertyToParents
Definition: qtpropertybrowser.cpp:1313
QtAbstractPropertyManager::QtProperty
friend class QtProperty
Definition: qtpropertybrowser.h:141
QtAbstractPropertyBrowserPrivate::slotPropertyInserted
void slotPropertyInserted(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty)
Definition: qtpropertybrowser.cpp:1592
QtAbstractPropertyManager::createProperty
virtual QtProperty * createProperty()
Definition: qtpropertybrowser.cpp:849
QtAbstractPropertyBrowser::clear
void clear()
Definition: qtpropertybrowser.cpp:1944
QtAbstractPropertyBrowserPrivate::m_topLevelIndexes
QList< QtBrowserItem * > m_topLevelIndexes
Definition: qtpropertybrowser.cpp:1316
QtProperty::~QtProperty
virtual ~QtProperty()
Definition: qtpropertybrowser.cpp:160
QtAbstractPropertyBrowser::unsetFactoryForManager
void unsetFactoryForManager(QtAbstractPropertyManager *manager)
Definition: qtpropertybrowser.cpp:2151
QtAbstractPropertyBrowser::properties
QList< QtProperty * > properties() const
Definition: qtpropertybrowser.cpp:1894
QtAbstractPropertyBrowserPrivate::m_managerToProperties
QMap< QtAbstractPropertyManager *, QList< QtProperty * > > m_managerToProperties
Definition: qtpropertybrowser.cpp:1312
QtBrowserItemPrivate::q_ptr
QtBrowserItem * q_ptr
Definition: qtpropertybrowser.cpp:1170
QtAbstractPropertyManager::addProperty
QtProperty * addProperty(const QString &name=QString())
Definition: qtpropertybrowser.cpp:826
QtBrowserItemPrivate::m_browser
QtAbstractPropertyBrowser *const m_browser
Definition: qtpropertybrowser.cpp:1166
QtAbstractPropertyManager::QtAbstractPropertyManager
QtAbstractPropertyManager(QObject *parent=0)
Definition: qtpropertybrowser.cpp:703
QtAbstractPropertyManagerPrivate::m_properties
QSet< QtProperty * > m_properties
Definition: qtpropertybrowser.cpp:88
QtProperty::hasValue
bool hasValue() const
Definition: qtpropertybrowser.cpp:277
QtProperty::setWhatsThis
void setWhatsThis(const QString &text)
Definition: qtpropertybrowser.cpp:358
QtAbstractPropertyBrowserPrivate::slotPropertyDataChanged
void slotPropertyDataChanged(QtProperty *property)
Definition: qtpropertybrowser.cpp:1628
index
uint8_t index
Definition: EtherCATFrame.h:59
QtProperty::setStatusTip
void setStatusTip(const QString &text)
Definition: qtpropertybrowser.cpp:342
QtAbstractPropertyBrowserPrivate::slotPropertyRemoved
void slotPropertyRemoved(QtProperty *property, QtProperty *parentProperty)
Definition: qtpropertybrowser.cpp:1605
QtAbstractPropertyBrowser::itemChanged
virtual void itemChanged(QtBrowserItem *item)=0
QtAbstractPropertyBrowserPrivate::clearIndex
void clearIndex(QtBrowserItem *index)
Definition: qtpropertybrowser.cpp:1579
QtBrowserItem::browser
QtAbstractPropertyBrowser * browser() const
Definition: qtpropertybrowser.cpp:1262
QtAbstractPropertyManager::displayText
virtual QString displayText(const QtProperty *property) const
Definition: qtpropertybrowser.cpp:798
QtAbstractPropertyBrowserPrivate::slotPropertyDestroyed
void slotPropertyDestroyed(QtProperty *property)
Definition: qtpropertybrowser.cpp:1618
QtPropertyPrivate::m_toolTip
QString m_toolTip
Definition: qtpropertybrowser.cpp:104
QtBrowserItemPrivate::m_property
QtProperty * m_property
Definition: qtpropertybrowser.cpp:1167
QtProperty::toolTip
QString toolTip() const
Definition: qtpropertybrowser.cpp:217
QtAbstractPropertyBrowser
QtAbstractPropertyBrowser provides a base class for implementing property browsers.
Definition: qtpropertybrowser.h:289
QtProperty::statusTip
QString statusTip() const
Definition: qtpropertybrowser.cpp:227
QtAbstractPropertyBrowser::items
QList< QtBrowserItem * > items(QtProperty *property) const
Definition: qtpropertybrowser.cpp:1908
QtAbstractPropertyBrowserPrivate::insertSubTree
void insertSubTree(QtProperty *property, QtProperty *parentProperty)
Definition: qtpropertybrowser.cpp:1327
QtProperty::isEnabled
bool isEnabled() const
Definition: qtpropertybrowser.cpp:257
QtAbstractPropertyBrowserPrivate::m_subItems
QList< QtProperty * > m_subItems
Definition: qtpropertybrowser.cpp:1311
QtPropertyPrivate::m_name
QString m_name
Definition: qtpropertybrowser.cpp:107
QtBrowserItem
The QtBrowserItem class represents a property in a property browser instance.
Definition: qtpropertybrowser.h:273
QtAbstractPropertyManager::hasValue
virtual bool hasValue(const QtProperty *property) const
Definition: qtpropertybrowser.cpp:753
QtPropertyPrivate::m_parentItems
QSet< QtProperty * > m_parentItems
Definition: qtpropertybrowser.cpp:101
QtBrowserItem::children
QList< QtBrowserItem * > children() const
Definition: qtpropertybrowser.cpp:1253
QtBrowserItem::parent
QtBrowserItem * parent() const
Definition: qtpropertybrowser.cpp:1233
QtProperty::valueText
QString valueText() const
Definition: qtpropertybrowser.cpp:303
QtProperty
The QtProperty class encapsulates an instance of a property.
Definition: qtpropertybrowser.h:71
QtProperty::propertyChanged
void propertyChanged()
Definition: qtpropertybrowser.cpp:553
QtAbstractPropertyBrowserPrivate::removeSubTree
void removeSubTree(QtProperty *property, QtProperty *parentProperty)
Definition: qtpropertybrowser.cpp:1372
QtAbstractPropertyManager::echoMode
virtual EchoMode echoMode(const QtProperty *) const
Definition: qtpropertybrowser.cpp:812
armarx::armem::contains
bool contains(const MemoryID &general, const MemoryID &specific)
Indicates whether general is "less specific" than, or equal to, specific, i.e.
Definition: MemoryID.cpp:558
QtAbstractPropertyManager::~QtAbstractPropertyManager
~QtAbstractPropertyManager() override
Definition: qtpropertybrowser.cpp:715
QtAbstractPropertyBrowser::createEditor
virtual QWidget * createEditor(QtProperty *property, QWidget *parent)
Definition: qtpropertybrowser.cpp:2096
QtProperty::insertSubProperty
void insertSubProperty(QtProperty *property, QtProperty *afterProperty)
Definition: qtpropertybrowser.cpp:452
QtAbstractPropertyManagerPrivate::propertyChanged
void propertyChanged(QtProperty *property) const
Definition: qtpropertybrowser.cpp:570
qtpropertybrowser.h
QtProperty::setPropertyName
void setPropertyName(const QString &text)
Definition: qtpropertybrowser.cpp:376
QtAbstractPropertyBrowser::currentItemChanged
void currentItemChanged(QtBrowserItem *)
QtPropertyPrivate::q_ptr
QtProperty * q_ptr
Definition: qtpropertybrowser.cpp:99
QtAbstractPropertyManagerPrivate::propertyRemoved
void propertyRemoved(QtProperty *property, QtProperty *parentProperty) const
Definition: qtpropertybrowser.cpp:575
QtAbstractEditorFactoryBase
The QtAbstractEditorFactoryBase provides an interface for editor factories.
Definition: qtpropertybrowser.h:147
QtBrowserItemPrivate::m_parent
QtBrowserItem * m_parent
Definition: qtpropertybrowser.cpp:1168
QtProperty::propertyName
QString propertyName() const
Definition: qtpropertybrowser.cpp:247
QtPropertyPrivate::m_manager
QtAbstractPropertyManager *const m_manager
Definition: qtpropertybrowser.cpp:111
QtAbstractPropertyBrowserPrivate::m_currentItem
QtBrowserItem * m_currentItem
Definition: qtpropertybrowser.cpp:1319
Map1
QMap< QtAbstractPropertyBrowser *, QMap< QtAbstractPropertyManager *, QtAbstractEditorFactoryBase * > > Map1
Definition: qtpropertybrowser.cpp:1282
QtAbstractEditorFactoryBase::createEditor
virtual QWidget * createEditor(QtProperty *property, QWidget *parent)=0
QtAbstractPropertyBrowserPrivate
Definition: qtpropertybrowser.cpp:1288
QtAbstractPropertyBrowserPrivate::QtAbstractPropertyBrowserPrivate
QtAbstractPropertyBrowserPrivate()
Definition: qtpropertybrowser.cpp:1322
QtAbstractPropertyManager::properties
QSet< QtProperty * > properties() const
Definition: qtpropertybrowser.cpp:741
QtAbstractEditorFactoryBase::breakConnection
virtual void breakConnection(QtAbstractPropertyManager *manager)=0
QtProperty::whatsThis
QString whatsThis() const
Definition: qtpropertybrowser.cpp:237
QtAbstractPropertyManagerPrivate::propertyInserted
void propertyInserted(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty) const
Definition: qtpropertybrowser.cpp:581
QtProperty::propertyManager
QtAbstractPropertyManager * propertyManager() const
Definition: qtpropertybrowser.cpp:207
QtPropertyPrivate::m_subItems
QList< QtProperty * > m_subItems
Definition: qtpropertybrowser.cpp:102
QtBrowserItemPrivate::removeChild
void removeChild(QtBrowserItem *index)
Definition: qtpropertybrowser.cpp:1187
QtProperty::setModified
void setModified(bool modified)
Definition: qtpropertybrowser.cpp:408
QtAbstractPropertyBrowser::removeProperty
void removeProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:2048
QtAbstractPropertyManager::propertyRemoved
void propertyRemoved(QtProperty *property, QtProperty *parent)
QtAbstractPropertyManagerPrivate::propertyDestroyed
void propertyDestroyed(QtProperty *property)
Definition: qtpropertybrowser.cpp:560
QtAbstractPropertyManager::propertyDestroyed
void propertyDestroyed(QtProperty *property)
QtBrowserItemPrivate::QtBrowserItemPrivate
QtBrowserItemPrivate(QtAbstractPropertyBrowser *browser, QtProperty *property, QtBrowserItem *parent)
Definition: qtpropertybrowser.cpp:1160
QtProperty::setToolTip
void setToolTip(const QString &text)
Definition: qtpropertybrowser.cpp:326
QtProperty::subProperties
QList< QtProperty * > subProperties() const
Definition: qtpropertybrowser.cpp:199
QtAbstractPropertyBrowser::itemRemoved
virtual void itemRemoved(QtBrowserItem *item)=0
QtBrowserItemPrivate
Definition: qtpropertybrowser.cpp:1157
QtBrowserItem::property
QtProperty * property() const
Definition: qtpropertybrowser.cpp:1221
QtAbstractPropertyManager::propertyInserted
void propertyInserted(QtProperty *property, QtProperty *parent, QtProperty *after)
QtProperty::removeSubProperty
void removeSubProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:524
QtAbstractPropertyBrowser::topLevelItem
QtBrowserItem * topLevelItem(QtProperty *property) const
Definition: qtpropertybrowser.cpp:1922
QtAbstractPropertyManager
The QtAbstractPropertyManager provides an interface for property managers.
Definition: qtpropertybrowser.h:112
QtAbstractPropertyManagerPrivate
Definition: qtpropertybrowser.cpp:76
QtAbstractPropertyBrowser::topLevelItems
QList< QtBrowserItem * > topLevelItems() const
Definition: qtpropertybrowser.cpp:1933
EchoMode
QLineEdit::EchoMode EchoMode
Definition: qtpropertybrowser.h:66
QtAbstractPropertyManager::valueText
virtual QString valueText(const QtProperty *property) const
Definition: qtpropertybrowser.cpp:783
QtBrowserItemPrivate::addChild
void addChild(QtBrowserItem *index, QtBrowserItem *after)
Definition: qtpropertybrowser.cpp:1176
QtPropertyPrivate::QtPropertyPrivate
QtPropertyPrivate(QtAbstractPropertyManager *manager)
Definition: qtpropertybrowser.cpp:95
Map2
QMap< QtAbstractPropertyManager *, QMap< QtAbstractEditorFactoryBase *, QList< QtAbstractPropertyBrowser * > > > Map2
Definition: qtpropertybrowser.cpp:1284
QtPropertyPrivate
Definition: qtpropertybrowser.cpp:54
QtAbstractPropertyBrowser::currentItem
QtBrowserItem * currentItem() const
Definition: qtpropertybrowser.cpp:2187
QtProperty::setEnabled
void setEnabled(bool enable)
Definition: qtpropertybrowser.cpp:392
QtAbstractPropertyBrowserPrivate::removeBrowserIndex
void removeBrowserIndex(QtBrowserItem *index)
Definition: qtpropertybrowser.cpp:1546
QtPropertyPrivate::m_modified
bool m_modified
Definition: qtpropertybrowser.cpp:109
QtProperty::addSubProperty
void addSubProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:427
QtAbstractPropertyBrowserPrivate::m_topLevelPropertyToIndex
QMap< QtProperty *, QtBrowserItem * > m_topLevelPropertyToIndex
Definition: qtpropertybrowser.cpp:1315
QtAbstractPropertyBrowserPrivate::createBrowserIndex
QtBrowserItem * createBrowserIndex(QtProperty *property, QtBrowserItem *parentIndex, QtBrowserItem *afterIndex)
Definition: qtpropertybrowser.cpp:1480
QtAbstractPropertyBrowser::QtAbstractPropertyBrowser
QtAbstractPropertyBrowser(QWidget *parent=0)
Definition: qtpropertybrowser.cpp:1853
QtAbstractPropertyManager::propertyChanged
void propertyChanged(QtProperty *property)
QtAbstractPropertyManager::initializeProperty
virtual void initializeProperty(QtProperty *property)=0
QtAbstractPropertyManager::uninitializeProperty
virtual void uninitializeProperty(QtProperty *property)
Definition: qtpropertybrowser.cpp:882
QtAbstractPropertyBrowserPrivate::m_propertyToIndexes
QMap< QtProperty *, QList< QtBrowserItem * > > m_propertyToIndexes
Definition: qtpropertybrowser.cpp:1317
QtProperty::isModified
bool isModified() const
Definition: qtpropertybrowser.cpp:267
QtBrowserItemPrivate::m_children
QList< QtBrowserItem * > m_children
Definition: qtpropertybrowser.cpp:1172
QtAbstractPropertyManager::valueIcon
virtual QIcon valueIcon(const QtProperty *property) const
Definition: qtpropertybrowser.cpp:768
QtAbstractPropertyBrowser::insertProperty
QtBrowserItem * insertProperty(QtProperty *property, QtProperty *afterProperty)
Definition: qtpropertybrowser.cpp:1997
QtProperty::displayText
QString displayText() const
Definition: qtpropertybrowser.cpp:316
QtAbstractPropertyManager::clear
void clear() const
Definition: qtpropertybrowser.cpp:726
QtAbstractPropertyBrowser::setCurrentItem
void setCurrentItem(QtBrowserItem *)
Definition: qtpropertybrowser.cpp:2197
QtAbstractPropertyBrowser::~QtAbstractPropertyBrowser
~QtAbstractPropertyBrowser() override
Definition: qtpropertybrowser.cpp:1873
QtProperty::QtProperty
QtProperty(QtAbstractPropertyManager *manager)
Definition: qtpropertybrowser.cpp:145
QtPropertyPrivate::m_enabled
bool m_enabled
Definition: qtpropertybrowser.cpp:108
QtAbstractPropertyBrowserPrivate::createBrowserIndexes
void createBrowserIndexes(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty)
Definition: qtpropertybrowser.cpp:1420
QtAbstractPropertyBrowserPrivate::removeBrowserIndexes
void removeBrowserIndexes(QtProperty *property, QtProperty *parentProperty)
Definition: qtpropertybrowser.cpp:1512
QtProperty::valueIcon
QIcon valueIcon() const
Definition: qtpropertybrowser.cpp:290