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

Method data

ui/clienttoolmodel.cpp:37–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35ClientToolModel::~ClientToolModel() = default;
36
37QVariant ClientToolModel::data(const QModelIndex &index, int role) const
38{
39 if (!index.isValid())
40 return QVariant();
41
42 const ToolInfo tool = m_toolManager->tools().at(index.row());
43 switch (role) {
44 case Qt::DisplayRole:
45 return tool.name();
46 case ToolModelRole::ToolId:
47 return tool.id();
48 case ToolModelRole::ToolWidget:
49 return QVariant::fromValue(m_toolManager->widgetForIndex(index.row()));
50 case Qt::ToolTipRole:
51 if (!tool.remotingSupported() && Endpoint::instance()->isRemoteClient())
52 return tr("This tool does not work in out-of-process mode.");
53 return QVariant();
54 case ToolModelRole::ToolEnabled:
55 return tool.isEnabled();
56 case ToolModelRole::ToolHasUi:
57 return tool.hasUi();
58 case ToolModelRole::ToolFeedbackId: {
59 auto id = tool.id().toLower();
60 if (id.startsWith(QLatin1String("gammaray_")))
61 id = id.mid(9);
62 else if (id.startsWith(QLatin1String("gammaray::")))
63 id = id.mid(10);
64 return id;
65 }
66 }
67 return QVariant();
68}
69
70void ClientToolModel::toolEnabled(int toolIndex)
71{

Callers

nothing calls this directly

Calls 10

rowMethod · 0.80
hasUiMethod · 0.80
QVariantClass · 0.50
isValidMethod · 0.45
nameMethod · 0.45
idMethod · 0.45
widgetForIndexMethod · 0.45
remotingSupportedMethod · 0.45
isRemoteClientMethod · 0.45
isEnabledMethod · 0.45

Tested by

no test coverage detected