| 21 | } |
| 22 | |
| 23 | QAction* 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 | |
| 38 | IAssistant::~IAssistant() |
| 39 | { |
no test coverage detected