MCPcopy Create free account
hub / github.com/KDE/kdevelop / toQAction

Method toQAction

kdevplatform/interfaces/iassistant.cpp:23–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23QAction* IAssistantAction::toQAction(QObject* parent) const
24{
25 Q_ASSERT(QThread::currentThread() == ICore::self()->thread() && "Actions must be created in the application main thread"
26 "(implement createActions() to create your actions)");
27
28 auto* ret = new QAction(icon(), description(), parent);
29 ret->setToolTip(toolTip());
30
31 //Add the data as a QExplicitlySharedDataPointer to the action, so this assistant stays alive at least as long as the QAction
32 ret->setData(QVariant::fromValue(QExplicitlySharedDataPointer<IAssistantAction>(const_cast<IAssistantAction*>(this))));
33
34 connect(ret, &QAction::triggered, this, &IAssistantAction::execute);
35 return ret;
36}
37
38IAssistant::~IAssistant()
39{

Callers 2

contextMenuExtensionMethod · 0.80
contextMenuEventMethod · 0.80

Calls 3

threadMethod · 0.80
setToolTipMethod · 0.80
setDataMethod · 0.45

Tested by

no test coverage detected