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

Method objectSelected

plugins/textdocumentinspector/textdocumentinspector.cpp:61–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void TextDocumentInspector::objectSelected(QObject *obj)
62{
63 if (auto doc = qobject_cast<QTextDocument *>(obj)) {
64 const auto indexList = m_documentsModel->match(m_documentsModel->index(0, 0),
65 ObjectModel::ObjectRole,
66 QVariant::fromValue<QObject *>(doc), 1,
67 Qt::MatchExactly | Qt::MatchRecursive | Qt::MatchWrap);
68 if (indexList.isEmpty())
69 return;
70
71 const auto &index = indexList.first();
72 m_documentSelectionModel->select(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
73 } else if (auto docObj = qobject_cast<QTextObject *>(obj)) {
74 objectSelected(docObj->document());
75 } else if (auto layout = qobject_cast<QAbstractTextDocumentLayout *>(obj)) {
76 objectSelected(layout->document());
77 }
78}
79
80void TextDocumentInspector::documentSelected(const QItemSelection &selected,
81 const QItemSelection &deselected)

Callers

nothing calls this directly

Calls 4

matchMethod · 0.45
indexMethod · 0.45
isEmptyMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected