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

Method setContext

plugins/qmlsupport/qmlcontextmodel.cpp:39–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void QmlContextModel::setContext(QQmlContext *leafContext)
40{
41 if (!m_contexts.isEmpty()) {
42 if (m_contexts.last() != leafContext)
43 clear();
44 else
45 return;
46 }
47
48 if (!leafContext)
49 return;
50
51 Q_ASSERT(m_contexts.isEmpty());
52 QVector<QQmlContext *> tmp;
53 auto context = leafContext;
54 do {
55 tmp.push_back(context);
56 context = context->parentContext();
57 } while (context);
58 std::reverse(tmp.begin(), tmp.end());
59
60 beginInsertRows(QModelIndex(), 0, tmp.size() - 1);
61 m_contexts = std::move(tmp);
62 endInsertRows();
63}
64
65int QmlContextModel::columnCount(const QModelIndex &parent) const
66{

Callers 1

setQObjectMethod · 0.80

Calls 5

endMethod · 0.80
QModelIndexClass · 0.50
isEmptyMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected