qdesigner_internal::MetaDataBase Class Reference

#include <metadatabase_p.h>

Inheritance diagram for qdesigner_internal::MetaDataBase:

Inheritance graph
[legend]
Collaboration diagram for qdesigner_internal::MetaDataBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 74 of file metadatabase_p.h.

Public Member Functions

 MetaDataBase (QDesignerFormEditorInterface *core, QObject *parent=0)
virtual ~MetaDataBase ()
virtual QDesignerFormEditorInterfacecore () const
virtual QDesignerMetaDataBaseItemInterfaceitem (QObject *object) const
virtual void add (QObject *object)
virtual void remove (QObject *object)
virtual QList< QObject * > objects () const
void dump ()

Private Types

typedef QHash< QObject *,
MetaDataBaseItem * > 
ItemMap

Private Slots

void slotDestroyed (QObject *object)

Private Attributes

QDesignerFormEditorInterfacem_core
ItemMap m_items


Member Typedef Documentation

typedef QHash<QObject *, MetaDataBaseItem*> qdesigner_internal::MetaDataBase::ItemMap [private]

Definition at line 96 of file metadatabase_p.h.


Constructor & Destructor Documentation

qdesigner_internal::MetaDataBase::MetaDataBase ( QDesignerFormEditorInterface core,
QObject parent = 0 
)

Definition at line 88 of file metadatabase.cpp.

00089     : QDesignerMetaDataBaseInterface(parent),
00090       m_core(core)
00091 {
00092 }

qdesigner_internal::MetaDataBase::~MetaDataBase (  )  [virtual]

Definition at line 94 of file metadatabase.cpp.

References m_items, and qDeleteAll().

00095 {
00096     qDeleteAll(m_items);
00097 }

Here is the call graph for this function:


Member Function Documentation

QDesignerFormEditorInterface * qdesigner_internal::MetaDataBase::core (  )  const [virtual]

Returns the core interface that is associated with the meta database.

Implements QDesignerMetaDataBaseInterface.

Definition at line 146 of file metadatabase.cpp.

References m_core.

00147 {
00148     return m_core;
00149 }

QDesignerMetaDataBaseItemInterface * qdesigner_internal::MetaDataBase::item ( QObject object  )  const [virtual]

Returns the item in the meta database associated with the given object.

Implements QDesignerMetaDataBaseInterface.

Definition at line 99 of file metadatabase.cpp.

References i, m_items, object, and QHash< Key, T >::value().

Referenced by add(), qdesigner_internal::PropertyEditor::metaDataBaseItem(), remove(), and slotDestroyed().

00100 {
00101     MetaDataBaseItem *i = m_items.value(object);
00102     if (i == 0 || !i->enabled())
00103         return 0;
00104     return i;
00105 }

Here is the call graph for this function:

void qdesigner_internal::MetaDataBase::add ( QObject object  )  [virtual]

Adds the specified object to the meta database.

Implements QDesignerMetaDataBaseInterface.

Definition at line 107 of file metadatabase.cpp.

References QDesignerMetaDataBaseInterface::changed(), QObject::connect(), QObject::destroyed(), emit, QHash< Key, T >::insert(), item(), m_items, object, QDesignerMetaDataBaseItemInterface::setEnabled(), SIGNAL, SLOT, slotDestroyed(), and QHash< Key, T >::value().

00108 {
00109     MetaDataBaseItem *item = m_items.value(object);
00110     if (item != 0) {
00111         item->setEnabled(true);
00112         return;
00113     }
00114 
00115     item = new MetaDataBaseItem(object);
00116     m_items.insert(object, item);
00117     connect(object, SIGNAL(destroyed(QObject*)),
00118         this, SLOT(slotDestroyed(QObject*)));
00119 
00120     emit changed();
00121 }

Here is the call graph for this function:

void qdesigner_internal::MetaDataBase::remove ( QObject object  )  [virtual]

Removes the specified object from the meta database.

Implements QDesignerMetaDataBaseInterface.

Definition at line 123 of file metadatabase.cpp.

References QDesignerMetaDataBaseInterface::changed(), emit, item(), m_items, object, QDesignerMetaDataBaseItemInterface::setEnabled(), and QHash< Key, T >::value().

00124 {
00125     Q_ASSERT(object);
00126 
00127     if (MetaDataBaseItem *item = m_items.value(object)) {
00128         item->setEnabled(false);
00129         emit changed();
00130     }
00131 }

Here is the call graph for this function:

QList< QObject * > qdesigner_internal::MetaDataBase::objects (  )  const [virtual]

Returns the list of objects that have corresponding items in the meta database.

Implements QDesignerMetaDataBaseInterface.

Definition at line 133 of file metadatabase.cpp.

References QList< T >::append(), QHash< Key, T >::begin(), QHash< Key, T >::end(), QHash< Key, T >::const_iterator::key(), m_items, and QHash< Key, T >::const_iterator::value().

00134 {
00135     QList<QObject*> result;
00136 
00137     ItemMap::const_iterator it = m_items.begin();
00138     for (; it != m_items.end(); ++it) {
00139         if (it.value()->enabled())
00140             result.append(it.key());
00141     }
00142 
00143     return result;
00144 }

Here is the call graph for this function:

void qdesigner_internal::MetaDataBase::dump (  ) 

Definition at line 160 of file metadatabase.cpp.

References m_items, and qDebug().

00161 {
00162     QHashIterator<QObject *, MetaDataBaseItem*> it(m_items);
00163     while (it.hasNext()) {
00164         it.next();
00165 
00166         qDebug() << it.value() << "item:" << it.key() << "comments:" << it.value()->comments();
00167     }
00168 }

Here is the call graph for this function:

void qdesigner_internal::MetaDataBase::slotDestroyed ( QObject object  )  [private, slot]

Definition at line 151 of file metadatabase.cpp.

References QHash< Key, T >::contains(), item(), m_items, object, QHash< Key, T >::remove(), and QHash< Key, T >::value().

Referenced by add().

00152 {
00153     if (m_items.contains(object)) {
00154         MetaDataBaseItem *item = m_items.value(object);
00155         delete item;
00156         m_items.remove(object);
00157     }
00158 }


Member Data Documentation

QDesignerFormEditorInterface* qdesigner_internal::MetaDataBase::m_core [private]

Definition at line 95 of file metadatabase_p.h.

Referenced by core().

ItemMap qdesigner_internal::MetaDataBase::m_items [private]

Definition at line 97 of file metadatabase_p.h.

Referenced by add(), dump(), item(), objects(), remove(), slotDestroyed(), and ~MetaDataBase().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 20:43:35 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1