MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / CodeLensTree

Method CodeLensTree

src/plugins/codeeditor/codelens/codelenstree.cpp:16–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace dpfservice;
15
16CodeLensTree::CodeLensTree(QWidget *parent)
17 : QTreeView(parent)
18{
19 setModel(new QStandardItemModel(this));
20 setEnabled(true);
21 setEditTriggers(QAbstractItemView::NoEditTriggers);
22 setItemDelegate(new CodeLensDelegate(this));
23 setHeaderHidden(true);
24 setLineWidth(0);
25
26 QObject::connect(this, &QTreeView::doubleClicked, [=](const QModelIndex &index) {
27 if (!index.parent().isValid()) //root return
28 return;
29
30 int line = index.data(CodeLensItemRole::LineRole).toInt();
31 int column = index.data(CodeLensItemRole::TermStartRole).toInt();
32 QModelIndex parentIndex = index;
33 while (parentIndex.parent().isValid()) {
34 parentIndex = index.parent();
35 }
36 QString filePath = parentIndex.data(Qt::DisplayRole).toString();
37 emit CodeLensTree::doubleClicked(filePath, line, column);
38 });
39}
40
41QString codeDataFormat(int line, const QString &codeText)
42{

Callers

nothing calls this directly

Calls 5

connectFunction · 0.85
isValidMethod · 0.45
parentMethod · 0.45
dataMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected