forked from qt-creator/qt-creator
TaskHandler: Use named property to store handler in action
Change-Id: Ia946bcca0a1143b00d8a4ab2a71b2bd0f894aad8 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -310,7 +310,10 @@ TaskWindow::~TaskWindow()
|
|||||||
|
|
||||||
static ITaskHandler *handler(QAction *action)
|
static ITaskHandler *handler(QAction *action)
|
||||||
{
|
{
|
||||||
return qobject_cast<ITaskHandler *>(action->data().value<QObject *>());
|
QVariant prop = action->property("ITaskHandler");
|
||||||
|
ITaskHandler *handler = qobject_cast<ITaskHandler *>(prop.value<QObject *>());
|
||||||
|
QTC_CHECK(handler);
|
||||||
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskWindow::delayedInitialization()
|
void TaskWindow::delayedInitialization()
|
||||||
@@ -328,7 +331,7 @@ void TaskWindow::delayedInitialization()
|
|||||||
|
|
||||||
QAction *action = h->createAction(this);
|
QAction *action = h->createAction(this);
|
||||||
QTC_ASSERT(action, continue);
|
QTC_ASSERT(action, continue);
|
||||||
action->setData(qVariantFromValue(qobject_cast<QObject*>(h)));
|
action->setProperty("ITaskHandler", qVariantFromValue(qobject_cast<QObject*>(h)));
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(actionTriggered()));
|
connect(action, SIGNAL(triggered()), this, SLOT(actionTriggered()));
|
||||||
d->m_actions << action;
|
d->m_actions << action;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user