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

Method widgetForIndex

ui/clienttoolmanager.cpp:218–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218QWidget *ClientToolManager::widgetForIndex(int index) const
219{
220 if (index < 0 || index >= m_tools.size())
221 return nullptr;
222 const ToolInfo &tool = m_tools.at(index);
223 if (!tool.isEnabled())
224 return nullptr;
225 auto it = m_widgets.constFind(tool.id());
226 if (it != m_widgets.constEnd() && it.value())
227 return it.value();
228 ToolUiFactory *factory = s_pluginRepository()->factories.value(tool.id());
229 if (!factory)
230 return nullptr;
231 if (s_pluginRepository()->uninitializedTools.contains(factory)) {
232 factory->initUi();
233 s_pluginRepository()->uninitializedTools.remove(factory);
234 }
235 QWidget *widget = factory->createWidget(m_parentWidget);
236 m_widgets.insert(tool.id(), widget);
237 return widget;
238}
239
240void ClientToolManager::gotTools(const QVector<GammaRay::ToolData> &tools)
241{

Callers 1

dataMethod · 0.45

Calls 9

sizeMethod · 0.45
isEnabledMethod · 0.45
idMethod · 0.45
constEndMethod · 0.45
valueMethod · 0.45
initUiMethod · 0.45
removeMethod · 0.45
createWidgetMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected