50#pragma warning(disable : 4786)
164 QSetIterator<QtProperty*> itParent(d_ptr->m_parentItems);
166 while (itParent.hasNext())
169 property->d_ptr->m_manager->d_ptr->propertyRemoved(
this, property);
172 d_ptr->m_manager->d_ptr->propertyDestroyed(
this);
174 QListIterator<QtProperty*> itChild(d_ptr->m_subItems);
176 while (itChild.hasNext())
179 property->d_ptr->m_parentItems.remove(
this);
184 while (itParent.hasNext())
187 property->d_ptr->m_subItems.removeAll(
this);
204 return d_ptr->m_subItems;
213 return d_ptr->m_manager;
224 return d_ptr->m_toolTip;
235 return d_ptr->m_statusTip;
246 return d_ptr->m_whatsThis;
257 return d_ptr->m_name;
268 return d_ptr->m_enabled;
279 return d_ptr->m_modified;
290 return d_ptr->m_manager->
hasValue(
this);
304 return d_ptr->m_manager->valueIcon(
this);
318 return d_ptr->m_manager->valueText(
this);
332 return d_ptr->m_manager->displayText(
this);
343 if (d_ptr->m_toolTip == text)
348 d_ptr->m_toolTip = text;
360 if (d_ptr->m_statusTip == text)
365 d_ptr->m_statusTip = text;
377 if (d_ptr->m_whatsThis == text)
382 d_ptr->m_whatsThis = text;
396 if (d_ptr->m_name == text)
401 d_ptr->m_name = text;
413 if (d_ptr->m_enabled == enable)
418 d_ptr->m_enabled = enable;
430 if (d_ptr->m_modified == modified)
435 d_ptr->m_modified = modified;
452 if (d_ptr->m_subItems.count() > 0)
454 after = d_ptr->m_subItems.last();
481 if (property ==
this)
487 QList<QtProperty*> pendingList =
property->subProperties();
488 QMap<QtProperty*, bool> visited;
490 while (!pendingList.isEmpty())
499 pendingList.removeFirst();
501 if (visited.contains(i))
515 while (pos < pendingList.count())
524 if (i == afterProperty)
527 properAfterProperty = afterProperty;
533 d_ptr->m_subItems.insert(newPos, property);
534 property->d_ptr->m_parentItems.insert(
this);
536 d_ptr->m_manager->d_ptr->propertyInserted(property,
this, properAfterProperty);
553 d_ptr->m_manager->d_ptr->propertyRemoved(property,
this);
558 while (pos < pendingList.count())
560 if (pendingList.at(pos) == property)
562 d_ptr->m_subItems.removeAt(pos);
563 property->d_ptr->m_parentItems.remove(
this);
578 d_ptr->m_manager->d_ptr->propertyChanged(
this);
588 emit q_ptr->propertyDestroyed(property);
589 q_ptr->uninitializeProperty(property);
597 emit q_ptr->propertyChanged(property);
604 emit q_ptr->propertyRemoved(property, parentProperty);
612 emit q_ptr->propertyInserted(property, parentProperty, afterProperty);
757 QSetIterator<QtProperty*> itProperty(
properties());
771 return d_ptr->m_properties;
848 return QLineEdit::Normal;
866 property->setPropertyName(name);
867 d_ptr->m_properties.insert(property);
1265 return d_ptr->m_property;
1278 return d_ptr->m_parent;
1296QList<QtBrowserItem*>
1299 return d_ptr->m_children;
1309 return d_ptr->m_browser;
1317 d_ptr->
q_ptr =
this;
1320QtBrowserItem::~QtBrowserItem()
1328 QMap<QtAbstractPropertyManager*, QtAbstractEditorFactoryBase*>>
1331 QMap<QtAbstractEditorFactoryBase*, QList<QtAbstractPropertyBrowser*>>>
1333Q_GLOBAL_STATIC(
Map1, m_viewToManagerToFactory)
1334Q_GLOBAL_STATIC(
Map2, m_managerToFactoryToViews)
1395 q_ptr->connect(manager,
1399 q_ptr->connect(manager,
1403 q_ptr->connect(manager,
1407 q_ptr->connect(manager,
1416 QList<QtProperty*> subList =
property->subProperties();
1417 QListIterator<QtProperty*> itSub(subList);
1419 while (itSub.hasNext())
1449 q_ptr->disconnect(manager,
1453 q_ptr->disconnect(manager,
1457 q_ptr->disconnect(manager,
1461 q_ptr->disconnect(manager,
1469 QList<QtProperty*> subList =
property->subProperties();
1470 QListIterator<QtProperty*> itSub(subList);
1472 while (itSub.hasNext())
1484 QMap<QtBrowserItem*, QtBrowserItem*> parentToAfter;
1488 QMap<QtProperty*, QList<QtBrowserItem*>>::ConstIterator it =
1496 QList<QtBrowserItem*> indexes = it.value();
1497 QListIterator<QtBrowserItem*> itIndex(indexes);
1499 while (itIndex.hasNext())
1504 if ((parentProperty && parentIdx && parentIdx->
property() == parentProperty) ||
1505 (!parentProperty && !parentIdx))
1507 parentToAfter[idx->
parent()] = idx;
1511 else if (parentProperty)
1513 QMap<QtProperty*, QList<QtBrowserItem*>>::ConstIterator it =
1521 QList<QtBrowserItem*> indexes = it.value();
1522 QListIterator<QtBrowserItem*> itIndex(indexes);
1524 while (itIndex.hasNext())
1527 parentToAfter[idx] = 0;
1532 parentToAfter[0] = 0;
1535 const QMap<QtBrowserItem*, QtBrowserItem*>::ConstIterator pcend = parentToAfter.constEnd();
1537 for (QMap<QtBrowserItem*, QtBrowserItem*>::ConstIterator it = parentToAfter.constBegin();
1554 parentIndex->d_ptr->
addChild(newIndex, afterIndex);
1564 q_ptr->itemInserted(newIndex, afterIndex);
1566 QList<QtProperty*> subItems =
property->subProperties();
1567 QListIterator<QtProperty*> itChild(subItems);
1570 while (itChild.hasNext())
1583 QList<QtBrowserItem*> toRemove;
1584 QMap<QtProperty*, QList<QtBrowserItem*>>::ConstIterator it =
m_propertyToIndexes.find(property);
1591 QList<QtBrowserItem*> indexes = it.value();
1592 QListIterator<QtBrowserItem*> itIndex(indexes);
1594 while (itIndex.hasNext())
1599 if ((parentProperty && parentIdx && parentIdx->
property() == parentProperty) ||
1600 (!parentProperty && !parentIdx))
1602 toRemove.append(idx);
1606 QListIterator<QtBrowserItem*> itRemove(toRemove);
1608 while (itRemove.hasNext())
1618 QList<QtBrowserItem*> children =
index->children();
1620 for (
int i = children.count(); i > 0; i--)
1625 q_ptr->itemRemoved(
index);
1627 if (
index->parent())
1652 QList<QtBrowserItem*> children =
index->children();
1653 QListIterator<QtBrowserItem*> itChild(children);
1655 while (itChild.hasNext())
1702 q_ptr->removeProperty(property);
1713 QMap<QtProperty*, QList<QtBrowserItem*>>::ConstIterator it =
m_propertyToIndexes.find(property);
1720 QList<QtBrowserItem*> indexes = it.value();
1721 QListIterator<QtBrowserItem*> itIndex(indexes);
1723 while (itIndex.hasNext())
1726 q_ptr->itemChanged(idx);
1933 d_ptr->q_ptr =
this;
1951 QListIterator<QtBrowserItem*> itItem(indexes);
1953 while (itItem.hasNext())
1955 d_ptr->clearIndex(itItem.next());
1972 return d_ptr->m_subItems;
1984QList<QtBrowserItem*>
1987 return d_ptr->m_propertyToIndexes.value(property);
2002 return d_ptr->m_topLevelPropertyToIndex.value(property);
2011QList<QtBrowserItem*>
2014 return d_ptr->m_topLevelIndexes;
2027 QListIterator<QtProperty*> itSub(subList);
2030 while (itSub.hasPrevious())
2054 if (d_ptr->m_subItems.count() > 0)
2056 afterProperty = d_ptr->m_subItems.last();
2087 QList<QtProperty*> pendingList =
properties();
2091 while (pos < pendingList.count())
2095 if (prop == property)
2100 if (prop == afterProperty)
2108 d_ptr->createBrowserIndexes(property, 0, afterProperty);
2111 d_ptr->insertSubTree(property, 0);
2113 d_ptr->m_subItems.insert(newPos, property);
2137 QList<QtProperty*> pendingList =
properties();
2140 while (pos < pendingList.count())
2142 if (pendingList.at(pos) == property)
2144 d_ptr->m_subItems.removeAt(pos);
2145 d_ptr->removeSubTree(property, 0);
2148 d_ptr->removeBrowserIndexes(property, 0);
2184 if (m_viewToManagerToFactory()->contains(
this) &&
2185 (*m_viewToManagerToFactory())[
this].contains(manager))
2187 factory = (*m_viewToManagerToFactory())[
this][manager];
2202 bool connectNeeded =
false;
2204 if (!m_managerToFactoryToViews()->contains(abstractManager) ||
2205 !(*m_managerToFactoryToViews())[abstractManager].contains(abstractFactory))
2207 connectNeeded =
true;
2209 else if ((*m_managerToFactoryToViews())[abstractManager][abstractFactory].
contains(
this))
2211 return connectNeeded;
2214 if (m_viewToManagerToFactory()->
contains(
this) &&
2215 (*m_viewToManagerToFactory())[
this].
contains(abstractManager))
2220 (*m_managerToFactoryToViews())[abstractManager][abstractFactory].append(
this);
2221 (*m_viewToManagerToFactory())[
this][abstractManager] = abstractFactory;
2223 return connectNeeded;
2236 if (!m_viewToManagerToFactory()->contains(
this) ||
2237 !(*m_viewToManagerToFactory())[
this].contains(manager))
2243 (*m_viewToManagerToFactory())[
this].remove(manager);
2245 if ((*m_viewToManagerToFactory())[
this].isEmpty())
2247 (*m_viewToManagerToFactory()).remove(
this);
2250 (*m_managerToFactoryToViews())[manager][abstractFactory].removeAll(
this);
2252 if ((*m_managerToFactoryToViews())[manager][abstractFactory].isEmpty())
2254 (*m_managerToFactoryToViews())[manager].remove(abstractFactory);
2257 if ((*m_managerToFactoryToViews())[manager].isEmpty())
2259 (*m_managerToFactoryToViews()).remove(manager);
2272 return d_ptr->m_currentItem;
2284 d_ptr->m_currentItem = item;
2286 if (oldItem != item)
2294#include "moc_qtpropertybrowser.cpp"
The QtAbstractEditorFactoryBase provides an interface for editor factories.
virtual void breakConnection(QtAbstractPropertyManager *manager)=0
virtual QWidget * createEditor(QtProperty *property, QWidget *parent)=0
void slotPropertyInserted(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty)
void slotPropertyDataChanged(QtProperty *property)
void insertSubTree(QtProperty *property, QtProperty *parentProperty)
void clearIndex(QtBrowserItem *index)
void slotPropertyDestroyed(QtProperty *property)
QMap< QtProperty *, QList< QtProperty * > > m_propertyToParents
void createBrowserIndexes(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty)
QMap< QtProperty *, QList< QtBrowserItem * > > m_propertyToIndexes
QMap< QtAbstractPropertyManager *, QList< QtProperty * > > m_managerToProperties
QtBrowserItem * createBrowserIndex(QtProperty *property, QtBrowserItem *parentIndex, QtBrowserItem *afterIndex)
void removeSubTree(QtProperty *property, QtProperty *parentProperty)
void removeBrowserIndexes(QtProperty *property, QtProperty *parentProperty)
QtBrowserItem * m_currentItem
QList< QtProperty * > m_subItems
QtAbstractPropertyBrowserPrivate()
QList< QtBrowserItem * > m_topLevelIndexes
QMap< QtProperty *, QtBrowserItem * > m_topLevelPropertyToIndex
void removeBrowserIndex(QtBrowserItem *index)
void slotPropertyRemoved(QtProperty *property, QtProperty *parentProperty)
QtAbstractPropertyBrowser provides a base class for implementing property browsers.
QtBrowserItem * currentItem() const
QtAbstractPropertyBrowser(QWidget *parent=0)
void currentItemChanged(QtBrowserItem *)
QtBrowserItem * insertProperty(QtProperty *property, QtProperty *afterProperty)
virtual QWidget * createEditor(QtProperty *property, QWidget *parent)
void unsetFactoryForManager(QtAbstractPropertyManager *manager)
void removeProperty(QtProperty *property)
QList< QtProperty * > properties() const
QList< QtBrowserItem * > topLevelItems() const
QtBrowserItem * addProperty(QtProperty *property)
~QtAbstractPropertyBrowser() override
void setCurrentItem(QtBrowserItem *)
QtBrowserItem * topLevelItem(QtProperty *property) const
QList< QtBrowserItem * > items(QtProperty *property) const
void propertyDestroyed(QtProperty *property)
void propertyRemoved(QtProperty *property, QtProperty *parentProperty) const
void propertyChanged(QtProperty *property) const
void propertyInserted(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty) const
QSet< QtProperty * > m_properties
The QtAbstractPropertyManager provides an interface for property managers.
QSet< QtProperty * > properties() const
virtual QString valueText(const QtProperty *property) const
virtual QIcon valueIcon(const QtProperty *property) const
virtual void uninitializeProperty(QtProperty *property)
virtual QString displayText(const QtProperty *property) const
virtual EchoMode echoMode(const QtProperty *) const
QtAbstractPropertyManager(QObject *parent=0)
virtual void initializeProperty(QtProperty *property)=0
virtual QtProperty * createProperty()
QtProperty * addProperty(const QString &name=QString())
virtual bool hasValue(const QtProperty *property) const
~QtAbstractPropertyManager() override
QtAbstractPropertyBrowser *const m_browser
QtBrowserItemPrivate(QtAbstractPropertyBrowser *browser, QtProperty *property, QtBrowserItem *parent)
void removeChild(QtBrowserItem *index)
void addChild(QtBrowserItem *index, QtBrowserItem *after)
QList< QtBrowserItem * > m_children
The QtBrowserItem class represents a property in a property browser instance.
QList< QtBrowserItem * > children() const
QtBrowserItem * parent() const
QtAbstractPropertyBrowser * browser() const
QtProperty * property() const
QSet< QtProperty * > m_parentItems
QList< QtProperty * > m_subItems
QtPropertyPrivate(QtAbstractPropertyManager *manager)
QtAbstractPropertyManager *const m_manager
The QtProperty class encapsulates an instance of a property.
QString propertyName() const
QString valueText() const
void insertSubProperty(QtProperty *property, QtProperty *afterProperty)
void removeSubProperty(QtProperty *property)
QList< QtProperty * > subProperties() const
QString statusTip() const
QtAbstractPropertyManager * propertyManager() const
void setToolTip(const QString &text)
void setModified(bool modified)
QString whatsThis() const
void setEnabled(bool enable)
void setWhatsThis(const QString &text)
friend class QtAbstractPropertyManager
void setPropertyName(const QString &text)
void setStatusTip(const QString &text)
QString displayText() const
QtProperty(QtAbstractPropertyManager *manager)
void addSubProperty(QtProperty *property)
bool contains(const MemoryID &general, const MemoryID &specific)
Indicates whether general is "less specific" than, or equal to, specific, i.e.
QMap< QtAbstractPropertyManager *, QMap< QtAbstractEditorFactoryBase *, QList< QtAbstractPropertyBrowser * > > > Map2
QMap< QtAbstractPropertyBrowser *, QMap< QtAbstractPropertyManager *, QtAbstractEditorFactoryBase * > > Map1
QLineEdit::EchoMode EchoMode