Newer
Older
/****************************************************************************
**
** This file is part of a Qt Solutions component.
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions Commercial License Agreement provided
** with the Software or, alternatively, in accordance with the terms
** contained in a written agreement between you and Nokia.
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
****************************************************************************/
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "MantidQtWidgets/Common/QtPropertyBrowser/qtpropertybrowser.h"
#include <QtCore/QSet>
#include <QtGui/QIcon>
#if defined(Q_CC_MSVC)
# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#endif
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
#endif
/**
\class QtProperty
\brief The QtProperty class encapsulates an instance of a property.
Properties are created by objects of QtAbstractPropertyManager
subclasses; a manager can create properties of a given type, and
is used in conjunction with the QtAbstractPropertyBrowser class. A
property is always owned by the manager that created it, which can
be retrieved using the propertyManager() function.
QtProperty contains the most common property attributes, and
provides functions for retrieving as well as setting their values:
\table
\header \o Getter \o Setter
\row
\o propertyName() \o setPropertyName()
\row
\o statusTip() \o setStatusTip()
\row
\o toolTip() \o setToolTip()
\row
\o whatsThis() \o setWhatsThis()
\row
\o isEnabled() \o setEnabled()
\row
\o isModified() \o setModified()
\row
\o valueText() \o Nop
\row
\o valueIcon() \o Nop
\endtable
It is also possible to nest properties: QtProperty provides the
addSubProperty(), insertSubProperty() and removeSubProperty() functions to
manipulate the set of subproperties. Use the subProperties()
function to retrieve a property's current set of subproperties.
Note that nested properties are not owned by the parent property,
i.e. each subproperty is owned by the manager that created it.
\sa QtAbstractPropertyManager, QtBrowserItem
*/
/**
Creates a property with the given \a manager.
This constructor is only useful when creating a custom QtProperty
subclass (e.g. QtVariantProperty). To create a regular QtProperty
object, use the QtAbstractPropertyManager::addProperty()
function instead.
\sa QtAbstractPropertyManager::addProperty()
*/
QtProperty::QtProperty(QtAbstractPropertyManager *manager)
{
d_ptr = new QtPropertyPrivate(manager);
d_ptr->q_ptr = this;
}
/**
Destroys this property.
Note that subproperties are detached but not destroyed, i.e. they
can still be used in another context.
\sa QtAbstractPropertyManager::clear()
*/
QtProperty::~QtProperty()
{
QSetIterator<QtProperty *> itParent(d_ptr->m_parentItems);
while (itParent.hasNext()) {
QtProperty *property = itParent.next();
property->d_ptr->m_manager->d_ptr->propertyRemoved(this, property);
}
d_ptr->m_manager->d_ptr->propertyDestroyed(this);
QListIterator<QtProperty *> itChild(d_ptr->m_subItems);
while (itChild.hasNext()) {
QtProperty *property = itChild.next();
property->d_ptr->m_parentItems.remove(this);
}
itParent.toFront();
while (itParent.hasNext()) {
QtProperty *property = itParent.next();
property->d_ptr->m_subItems.removeAll(this);
}
delete d_ptr;
}
/**
Returns the set of subproperties.
Note that subproperties are not owned by \e this property, but by
the manager that created them.
\sa insertSubProperty(), removeSubProperty()
*/
QList<QtProperty *> QtProperty::subProperties() const
{
return d_ptr->m_subItems;
}
/**
Returns a pointer to the manager that owns this property.
*/
QtAbstractPropertyManager *QtProperty::propertyManager() const
{
return d_ptr->m_manager;
}
/**
Returns the property's tool tip.
\sa setToolTip()
*/
QString QtProperty::toolTip() const
{
return d_ptr->m_toolTip;
}
/**
Returns the property's status tip.
\sa setStatusTip()
*/
QString QtProperty::statusTip() const
{
return d_ptr->m_statusTip;
}
/**
Returns the property's "What's This" help text.
\sa setWhatsThis()
*/
QString QtProperty::whatsThis() const
{
return d_ptr->m_whatsThis;
}
/**
Returns the property's name.
\sa setPropertyName()
*/
QString QtProperty::propertyName() const
{
return d_ptr->m_name;
}
/**
Returns whether the property is enabled.
\sa setEnabled()
*/
bool QtProperty::isEnabled() const
{
return d_ptr->m_enabled;
}
/**
Returns whether the property is modified.
\sa setModified()
*/
bool QtProperty::isModified() const
{
return d_ptr->m_modified;
}
/**
Returns whether the property has a value.
\sa QtAbstractPropertyManager::hasValue()
*/
bool QtProperty::hasValue() const
{
return d_ptr->m_manager->hasValue(this);
}
/**
Returns an icon representing the current state of this property.
If the given property type can not generate such an icon, this
function returns an invalid icon.
\sa QtAbstractPropertyManager::valueIcon()
*/
QIcon QtProperty::valueIcon() const
{
return d_ptr->m_manager->valueIcon(this);
}
/**
Returns a string representing the current state of this property.
If the given property type can not generate such a string, this
function returns an empty string.
\sa QtAbstractPropertyManager::valueText()
*/
QString QtProperty::valueText() const
{
return d_ptr->m_manager->valueText(this);
}
/**
Sets the property's tool tip to the given \a text.
\sa toolTip()
*/
void QtProperty::setToolTip(const QString &text)
{
if (d_ptr->m_toolTip == text)
return;
d_ptr->m_toolTip = text;
propertyChanged();
}
/**
Sets the property's status tip to the given \a text.
\sa statusTip()
*/
void QtProperty::setStatusTip(const QString &text)
{
if (d_ptr->m_statusTip == text)
return;
d_ptr->m_statusTip = text;
propertyChanged();
}
/**
Sets the property's "What's This" help text to the given \a text.
\sa whatsThis()
*/
void QtProperty::setWhatsThis(const QString &text)
{
if (d_ptr->m_whatsThis == text)
return;
d_ptr->m_whatsThis = text;
propertyChanged();
}
/**
\fn void QtProperty::setPropertyName(const QString &name)
Sets the property's name to the given \a name.
\sa propertyName()
*/
void QtProperty::setPropertyName(const QString &text)
{
if (d_ptr->m_name == text)
return;
d_ptr->m_name = text;
propertyChanged();
}
/**
Enables or disables the property according to the passed \a enable value.
\sa isEnabled()
*/
void QtProperty::setEnabled(bool enable)
{
if (d_ptr->m_enabled == enable)
return;
d_ptr->m_enabled = enable;
propertyChanged();
Sets the property's modified state according to the passed \a modified value.
void QtProperty::setModified(bool modified)
{
if (d_ptr->m_modified == modified)
return;
d_ptr->m_modified = modified;
propertyChanged();
}
/**
Appends the given \a property to this property's subproperties.
If the given \a property already is added, this function does
nothing.
\sa insertSubProperty(), removeSubProperty()
*/
void QtProperty::addSubProperty(QtProperty *property)
{
QtProperty *after = 0;
if (d_ptr->m_subItems.count() > 0)
after = d_ptr->m_subItems.last();
insertSubProperty(property, after);
\fn void QtProperty::insertSubProperty(QtProperty *property, QtProperty *precedingProperty)
Inserts the given \a property after the specified \a
precedingProperty into this property's list of subproperties. If
\a precedingProperty is 0, the specified \a property is inserted
at the beginning of the list.
If the given \a property already is inserted, this function does
nothing.
\sa addSubProperty(), removeSubProperty()
*/
void QtProperty::insertSubProperty(QtProperty *property,
QtProperty *afterProperty)
{
if (!property)
return;
if (property == this)
return;
// traverse all children of item. if this item is a child of item then cannot add.
QList<QtProperty *> pendingList = property->subProperties();
QMap<QtProperty *, bool> visited;
while (!pendingList.isEmpty()) {
QtProperty *i = pendingList.first();
if (i == this)
return;
pendingList.removeFirst();
if (visited.contains(i))
continue;
visited[i] = true;
pendingList += i->subProperties();
pendingList = subProperties();
int pos = 0;
int newPos = 0;
QtProperty *properAfterProperty = 0;
while (pos < pendingList.count()) {
QtProperty *i = pendingList.at(pos);
if (i == property)
return; // if item is already inserted in this item then cannot add.
if (i == afterProperty) {
newPos = pos + 1;
properAfterProperty = afterProperty;
}
pos++;
}
d_ptr->m_subItems.insert(newPos, property);
property->d_ptr->m_parentItems.insert(this);
d_ptr->m_manager->d_ptr->propertyInserted(property, this, properAfterProperty);
}
/**
Removes the given \a property from the list of subproperties
without deleting it.
\sa addSubProperty(), insertSubProperty()
*/
void QtProperty::removeSubProperty(QtProperty *property)
{
if (!property)
return;
d_ptr->m_manager->d_ptr->propertyRemoved(property, this);
QList<QtProperty *> pendingList = subProperties();
int pos = 0;
while (pos < pendingList.count()) {
if (pendingList.at(pos) == property) {
d_ptr->m_subItems.removeAt(pos);
property->d_ptr->m_parentItems.remove(this);
bool QtProperty::hasOption(const QString &opt) const
{
return d_ptr->m_options.contains(opt);
}
bool QtProperty::checkOption(const QString &opt) const
{
if ( !d_ptr->m_options.contains(opt) ) return false;
return d_ptr->m_options[opt];
}
void QtProperty::setOption(const QString &opt, bool on)
{
d_ptr->m_options[opt] = on;
}
void QtProperty::propertyChanged()
{
d_ptr->m_manager->d_ptr->propertyChanged(this);
}
////////////////////////////////
void QtAbstractPropertyManagerPrivate::propertyDestroyed(QtProperty *property)
{
if (m_properties.contains(property)) {
emit q_ptr->propertyDestroyed(property);
q_ptr->uninitializeProperty(property);
m_properties.remove(property);
}
void QtAbstractPropertyManagerPrivate::propertyChanged(QtProperty *property) const
{
emit q_ptr->propertyChanged(property);
void QtAbstractPropertyManagerPrivate::propertyRemoved(QtProperty *property,
QtProperty *parentProperty) const
{
emit q_ptr->propertyRemoved(property, parentProperty);
void QtAbstractPropertyManagerPrivate::propertyInserted(QtProperty *property,
QtProperty *parentProperty, QtProperty *afterProperty) const
{
emit q_ptr->propertyInserted(property, parentProperty, afterProperty);
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
}
/**
\class QtAbstractPropertyManager
\brief The QtAbstractPropertyManager provides an interface for
property managers.
A manager can create and manage properties of a given type, and is
used in conjunction with the QtAbstractPropertyBrowser class.
When using a property browser widget, the properties are created
and managed by implementations of the QtAbstractPropertyManager
class. To ensure that the properties' values will be displayed
using suitable editing widgets, the managers are associated with
objects of QtAbstractEditorFactory subclasses. The property browser
will use these associations to determine which factories it should
use to create the preferred editing widgets.
The QtAbstractPropertyManager class provides common functionality
like creating a property using the addProperty() function, and
retrieving the properties created by the manager using the
properties() function. The class also provides signals that are
emitted when the manager's properties change: propertyInserted(),
propertyRemoved(), propertyChanged() and propertyDestroyed().
QtAbstractPropertyManager subclasses are supposed to provide their
own type specific API. Note that several ready-made
implementations are available:
\list
\o QtBoolPropertyManager
\o QtColorPropertyManager
\o QtDatePropertyManager
\o QtDateTimePropertyManager
\o QtDoublePropertyManager
\o QtEnumPropertyManager
\o QtFlagPropertyManager
\o QtFontPropertyManager
\o QtGroupPropertyManager
\o QtIntPropertyManager
\o QtPointPropertyManager
\o QtRectPropertyManager
\o QtSizePropertyManager
\o QtSizePolicyPropertyManager
\o QtStringPropertyManager
\o QtTimePropertyManager
\o QtVariantPropertyManager
\endlist
\sa QtAbstractEditorFactoryBase, QtAbstractPropertyBrowser, QtProperty
*/
/**
\fn void QtAbstractPropertyManager::propertyInserted(QtProperty *newProperty,
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
QtProperty *parentProperty, QtProperty *precedingProperty)
This signal is emitted when a new subproperty is inserted into an
existing property, passing pointers to the \a newProperty, \a
parentProperty and \a precedingProperty as parameters.
If \a precedingProperty is 0, the \a newProperty was inserted at
the beginning of the \a parentProperty's subproperties list.
Note that signal is emitted only if the \a parentProperty is created
by this manager.
\sa QtAbstractPropertyBrowser::itemInserted()
*/
/**
\fn void QtAbstractPropertyManager::propertyChanged(QtProperty *property)
This signal is emitted whenever a property's data changes, passing
a pointer to the \a property as parameter.
Note that signal is only emitted for properties that are created by
this manager.
\sa QtAbstractPropertyBrowser::itemChanged()
*/
/**
\fn void QtAbstractPropertyManager::propertyRemoved(QtProperty *property, QtProperty *parent)
This signal is emitted when a subproperty is removed, passing
pointers to the removed \a property and the \a parent property as
parameters.
Note that signal is emitted only when the \a parent property is
created by this manager.
\sa QtAbstractPropertyBrowser::itemRemoved()
*/
/**
\fn void QtAbstractPropertyManager::propertyDestroyed(QtProperty *property)
This signal is emitted when the specified \a property is about to
be destroyed.
Note that signal is only emitted for properties that are created
by this manager.
\sa clear(), uninitializeProperty()
*/
/**
\fn void QtAbstractPropertyBrowser::currentItemChanged(QtBrowserItem *current)
This signal is emitted when the current item changes. The current item is specified by \a current.
\sa QtAbstractPropertyBrowser::setCurrentItem()
*/
/**
Creates an abstract property manager with the given \a parent.
*/
QtAbstractPropertyManager::QtAbstractPropertyManager(QObject *parent)
: QObject(parent)
{
d_ptr = new QtAbstractPropertyManagerPrivate;
d_ptr->q_ptr = this;
}
/**
Destroys the manager. All properties created by the manager are
destroyed.
*/
QtAbstractPropertyManager::~QtAbstractPropertyManager()
{
clear();
delete d_ptr;
}
/**
Destroys all the properties that this manager has created.
\sa propertyDestroyed(), uninitializeProperty()
*/
void QtAbstractPropertyManager::clear() const
{
while (!properties().isEmpty()) {
QSetIterator<QtProperty *> itProperty(properties());
QtProperty *prop = itProperty.next();
delete prop;
}
}
/**
Returns the set of properties created by this manager.
\sa addProperty()
*/
QSet<QtProperty *> QtAbstractPropertyManager::properties() const
{
return d_ptr->m_properties;
}
/**
Returns whether the given \a property has a value.
The default implementation of this function returns true.
\sa QtProperty::hasValue()
*/
bool QtAbstractPropertyManager::hasValue(const QtProperty *property) const
{
Q_UNUSED(property)
return true;
}
/**
Returns an icon representing the current state of the given \a
property.
The default implementation of this function returns an invalid
icon.
\sa QtProperty::valueIcon()
*/
QIcon QtAbstractPropertyManager::valueIcon(const QtProperty *property) const
{
Q_UNUSED(property)
return QIcon();
}
/**
Returns a string representing the current state of the given \a
property.
The default implementation of this function returns an empty
string.
\sa QtProperty::valueText()
*/
QString QtAbstractPropertyManager::valueText(const QtProperty *property) const
{
Q_UNUSED(property)
return QString();
Creates a property with the given \a name which then is owned by this manager.
Internally, this function calls the createProperty() and
initializeProperty() functions.
\sa initializeProperty(), properties()
*/
QtProperty *QtAbstractPropertyManager::addProperty(const QString &name)
{
QtProperty *property = createProperty();
if (property) {
property->setPropertyName(name);
d_ptr->m_properties.insert(property);
initializeProperty(property);
}
return property;
}
/**
Creates a property.
The base implementation produce QtProperty instances; Reimplement
this function to make this manager produce objects of a QtProperty
subclass.
\sa addProperty(), initializeProperty()
*/
QtProperty *QtAbstractPropertyManager::createProperty()
{
return new QtProperty(this);
\fn void QtAbstractPropertyManager::initializeProperty(QtProperty *property) = 0
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
This function is called whenever a new valid property pointer has
been created, passing the pointer as parameter.
The purpose is to let the manager know that the \a property has
been created so that it can provide additional attributes for the
new property, e.g. QtIntPropertyManager adds \l
{QtIntPropertyManager::value()}{value}, \l
{QtIntPropertyManager::minimum()}{minimum} and \l
{QtIntPropertyManager::maximum()}{maximum} attributes. Since each manager
subclass adds type specific attributes, this function is pure
virtual and must be reimplemented when deriving from the
QtAbstractPropertyManager class.
\sa addProperty(), createProperty()
*/
/**
This function is called just before the specified \a property is destroyed.
The purpose is to let the property manager know that the \a
property is being destroyed so that it can remove the property's
additional attributes.
\sa clear(), propertyDestroyed()
*/
void QtAbstractPropertyManager::uninitializeProperty(QtProperty *property)
{
Q_UNUSED(property)
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
}
////////////////////////////////////
/**
\class QtAbstractEditorFactoryBase
\brief The QtAbstractEditorFactoryBase provides an interface for
editor factories.
An editor factory is a class that is able to create an editing
widget of a specified type (e.g. line edits or comboboxes) for a
given QtProperty object, and it is used in conjunction with the
QtAbstractPropertyManager and QtAbstractPropertyBrowser classes.
When using a property browser widget, the properties are created
and managed by implementations of the QtAbstractPropertyManager
class. To ensure that the properties' values will be displayed
using suitable editing widgets, the managers are associated with
objects of QtAbstractEditorFactory subclasses. The property browser
will use these associations to determine which factories it should
use to create the preferred editing widgets.
Typically, an editor factory is created by subclassing the
QtAbstractEditorFactory template class which inherits
QtAbstractEditorFactoryBase. But note that several ready-made
implementations are available:
\list
\o QtCheckBoxFactory
\o QtDateEditFactory
\o QtDateTimeEditFactory
\o QtDoubleSpinBoxFactory
\o QtEnumEditorFactory
\o QtLineEditFactory
\o QtScrollBarFactory
\o QtSliderFactory
\o QtSpinBoxFactory
\o QtTimeEditFactory
\o QtVariantEditorFactory
\endlist
\sa QtAbstractPropertyManager, QtAbstractPropertyBrowser
*/
/**
\fn virtual QWidget *QtAbstractEditorFactoryBase::createEditor(QtProperty *property,
QWidget *parent) = 0
Creates an editing widget (with the given \a parent) for the given
\a property.
This function is reimplemented in QtAbstractEditorFactory template class
which also provides a pure virtual convenience overload of this
function enabling access to the property's manager.
\sa QtAbstractEditorFactory::createEditor()
*/
/**
\fn QtAbstractEditorFactoryBase::QtAbstractEditorFactoryBase(QObject *parent = 0)
Creates an abstract editor factory with the given \a parent.
*/
/**
\fn virtual void QtAbstractEditorFactoryBase::breakConnection(QtAbstractPropertyManager *manager) = 0
\internal
Detaches property manager from factory.
This method is reimplemented in QtAbstractEditorFactory template subclass.
You don't need to reimplement it in your subclasses. Instead implement more convenient
QtAbstractEditorFactory::disconnectPropertyManager() which gives you access to particular manager subclass.
\fn virtual void QtAbstractEditorFactoryBase::managerDestroyed(QObject *manager) = 0
\internal
This method is called when property manager is being destroyed.
Basically it notifies factory not to produce editors for properties owned by \a manager.
You don't need to reimplement it in your subclass. This method is implemented in
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
QtAbstractEditorFactory template subclass.
*/
/**
\class QtAbstractEditorFactory
\brief The QtAbstractEditorFactory is the base template class for editor
factories.
An editor factory is a class that is able to create an editing
widget of a specified type (e.g. line edits or comboboxes) for a
given QtProperty object, and it is used in conjunction with the
QtAbstractPropertyManager and QtAbstractPropertyBrowser classes.
Note that the QtAbstractEditorFactory functions are using the
PropertyManager template argument class which can be any
QtAbstractPropertyManager subclass. For example:
\code
QtSpinBoxFactory *factory;
QSet<QtIntPropertyManager *> managers = factory->propertyManagers();
\endcode
Note that QtSpinBoxFactory by definition creates editing widgets
\e only for properties created by QtIntPropertyManager.
When using a property browser widget, the properties are created
and managed by implementations of the QtAbstractPropertyManager
class. To ensure that the properties' values will be displayed
using suitable editing widgets, the managers are associated with
objects of QtAbstractEditorFactory subclasses. The property browser will
use these associations to determine which factories it should use
to create the preferred editing widgets.
A QtAbstractEditorFactory object is capable of producing editors for
several property managers at the same time. To create an
association between this factory and a given manager, use the
addPropertyManager() function. Use the removePropertyManager() function to make
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
this factory stop producing editors for a given property
manager. Use the propertyManagers() function to retrieve the set of
managers currently associated with this factory.
Several ready-made implementations of the QtAbstractEditorFactory class
are available:
\list
\o QtCheckBoxFactory
\o QtDateEditFactory
\o QtDateTimeEditFactory
\o QtDoubleSpinBoxFactory
\o QtEnumEditorFactory
\o QtLineEditFactory
\o QtScrollBarFactory
\o QtSliderFactory
\o QtSpinBoxFactory
\o QtTimeEditFactory
\o QtVariantEditorFactory
\endlist
When deriving from the QtAbstractEditorFactory class, several pure virtual
functions must be implemented: the connectPropertyManager() function is
used by the factory to connect to the given manager's signals, the
createEditor() function is supposed to create an editor for the
given property controlled by the given manager, and finally the
disconnectPropertyManager() function is used by the factory to disconnect
from the specified manager's signals.
\sa QtAbstractEditorFactoryBase, QtAbstractPropertyManager
*/
/**
\fn QtAbstractEditorFactory::QtAbstractEditorFactory(QObject *parent = 0)
Creates an editor factory with the given \a parent.
\sa addPropertyManager()
*/
/**
\fn QWidget *QtAbstractEditorFactory::createEditor(QtProperty *property, QWidget *parent)
Creates an editing widget (with the given \a parent) for the given
\a property.
*/
/**
\fn void QtAbstractEditorFactory::addPropertyManager(PropertyManager *manager)
Adds the given \a manager to this factory's set of managers,
making this factory produce editing widgets for properties created
by the given manager.
The PropertyManager type is a template argument class, and represents the chosen
QtAbstractPropertyManager subclass.
\sa propertyManagers(), removePropertyManager()
*/
/**
\fn void QtAbstractEditorFactory::removePropertyManager(PropertyManager *manager)
Removes the given \a manager from this factory's set of
managers. The PropertyManager type is a template argument class, and may be
any QtAbstractPropertyManager subclass.