MCPcopy Create free account
hub / github.com/KDAB/GammaRay / setMetaObject

Method setMetaObject

core/metaobjectmodel.h:38–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 }
37
38 virtual void setMetaObject(const QMetaObject *metaObject)
39 {
40 if (m_rowCount) {
41 beginRemoveRows(QModelIndex(), 0, m_rowCount - 1);
42 m_metaObject = nullptr;
43 m_rowCount = 0;
44 endRemoveRows();
45 } else {
46 m_metaObject = nullptr;
47 }
48
49 if (!metaObject)
50 return;
51 if (!Probe::instance()->metaObjectRegistry()->isValid(metaObject))
52 return;
53
54 const auto newRowCount = (metaObject->*MetaCount)();
55 if (newRowCount) {
56 beginInsertRows(QModelIndex(), 0, newRowCount - 1);
57 m_metaObject = metaObject;
58 m_rowCount = newRowCount;
59 endInsertRows();
60 } else {
61 m_metaObject = metaObject;
62 }
63 }
64
65 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
66 {

Callers

nothing calls this directly

Calls 3

metaObjectRegistryMethod · 0.80
QModelIndexClass · 0.70
isValidMethod · 0.45

Tested by

no test coverage detected