Commit 0d0c5057 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Change action in scoped pointer

Change-Id: I2d8dfe12378a47e012af16f8868eb48994620cbf
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent ac10d700
......@@ -33,15 +33,20 @@
namespace QmlDesigner {
DefaultDesignerAction::DefaultDesignerAction(const QString &description)
: m_action(new DefaultAction(description))
: m_defaultAction(new DefaultAction(description))
{
}
DefaultDesignerAction::DefaultDesignerAction(DefaultAction *action)
: m_action(action)
: m_defaultAction(action)
{
}
QAction *DefaultDesignerAction::action() const
{
return m_defaultAction.data();
}
void DefaultDesignerAction::currentContextChanged(const SelectionContext &selectionContext)
{
m_selectionContext = selectionContext;
......@@ -50,16 +55,16 @@ void DefaultDesignerAction::currentContextChanged(const SelectionContext &select
void DefaultDesignerAction::updateContext()
{
m_action->setSelectionContext(m_selectionContext);
m_defaultAction->setSelectionContext(m_selectionContext);
if (m_selectionContext.isValid()) {
m_action->setEnabled(isEnabled(m_selectionContext));
m_action->setVisible(isVisible(m_selectionContext));
m_defaultAction->setEnabled(isEnabled(m_selectionContext));
m_defaultAction->setVisible(isVisible(m_selectionContext));
}
}
DefaultAction *DefaultDesignerAction::defaultAction() const
{
return m_action;
return m_defaultAction.data();
}
SelectionContext DefaultDesignerAction::selectionContext() const
......
......@@ -34,6 +34,7 @@
#include "abstractdesigneraction.h"
#include <QAction>
#include <QScopedPointer>
namespace QmlDesigner {
......@@ -69,7 +70,7 @@ protected:
SelectionContext selectionContext() const;
private:
DefaultAction *m_action;
QScopedPointer<DefaultAction> m_defaultAction;
SelectionContext m_selectionContext;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment