Commit 72906cc7 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.ComponentCore: Making members private



Change-Id: I5674499c66acf6bb86abd0f56c318ceff021e1bb
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 30b206a5
......@@ -56,6 +56,11 @@ QMenu *AbstractActionGroup::menu() const
return m_menu.data();
}
SelectionContext AbstractActionGroup::selectionContext() const
{
return m_selectionContext;
}
void AbstractActionGroup::currentContextChanged(const SelectionContext &selectionContext)
{
m_selectionContext = selectionContext;
......
......@@ -48,11 +48,12 @@ public:
AbstractDesignerAction::Type type() const QTC_OVERRIDE;
QAction *action() const QTC_OVERRIDE;
QMenu *menu() const;
SelectionContext selectionContext() const;
virtual void currentContextChanged(const SelectionContext &selectionContext) QTC_OVERRIDE;
virtual void updateContext();
protected:
private:
const QString m_displayName;
SelectionContext m_selectionContext;
QScopedPointer<QMenu> m_menu;
......
......@@ -150,41 +150,41 @@ public:
virtual void updateContext()
{
m_menu->clear();
if (m_selectionContext.isValid()) {
m_action->setEnabled(isEnabled(m_selectionContext));
m_action->setVisible(isVisible(m_selectionContext));
menu()->clear();
if (selectionContext().isValid()) {
action()->setEnabled(isEnabled(selectionContext()));
action()->setVisible(isVisible(selectionContext()));
} else {
return;
}
if (m_action->isEnabled()) {
if (action()->isEnabled()) {
ModelNode parentNode;
if (m_selectionContext.singleNodeIsSelected()
&& !m_selectionContext.currentSingleSelectedNode().isRootNode()
&& m_selectionContext.currentSingleSelectedNode().hasParentProperty()) {
if (selectionContext().singleNodeIsSelected()
&& !selectionContext().currentSingleSelectedNode().isRootNode()
&& selectionContext().currentSingleSelectedNode().hasParentProperty()) {
ActionTemplate *selectionAction = new ActionTemplate(QString(), &ModelNodeOperations::select);
selectionAction->setParent(m_menu.data());
selectionAction->setParent(menu());
parentNode = m_selectionContext.currentSingleSelectedNode().parentProperty().parentModelNode();
m_selectionContext.setTargetNode(parentNode);
parentNode = selectionContext().currentSingleSelectedNode().parentProperty().parentModelNode();
selectionContext().setTargetNode(parentNode);
selectionAction->setText(QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select parent: %1")).arg(
captionForModelNode(parentNode)));
selectionAction->setSelectionContext(m_selectionContext);
selectionAction->setSelectionContext(selectionContext());
m_menu->addAction(selectionAction);
menu()->addAction(selectionAction);
}
foreach (const ModelNode &node, m_selectionContext.view()->allModelNodes()) {
if (node != m_selectionContext.currentSingleSelectedNode()
foreach (const ModelNode &node, selectionContext().view()->allModelNodes()) {
if (node != selectionContext().currentSingleSelectedNode()
&& node != parentNode
&& contains(node, m_selectionContext.scenePosition())
&& contains(node, selectionContext().scenePosition())
&& !node.isRootNode()) {
m_selectionContext.setTargetNode(node);
selectionContext().setTargetNode(node);
QString what = QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select: %1")).arg(captionForModelNode(node));
ActionTemplate *selectionAction = new ActionTemplate(what, &ModelNodeOperations::select);
selectionAction->setSelectionContext(m_selectionContext);
selectionAction->setSelectionContext(selectionContext());
m_menu->addAction(selectionAction);
menu()->addAction(selectionAction);
}
}
}
......
......@@ -134,9 +134,8 @@ public:
QByteArray menuId() const { return m_menuId; }
int priority() const { return m_priority; }
AbstractDesignerAction::Type type() const { return AbstractDesignerAction::Menu; }
QAction *action() const { return m_action; }
protected:
private:
const QByteArray m_menuId;
const int m_priority;
SelectionContextFunction m_enabled;
......
Supports Markdown
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