forked from qt-creator/qt-creator
QmlDesigner: code cleanup
Change-Id: Id2ce92b7b1f6bc190c0ac4899c951b8f3cff9535 Reviewed-on: http://codereview.qt-project.org/5225 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Marco Bubke <marco.bubke@nokia.com>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "formeditornodeinstanceview.h"
|
||||
#include "formeditoritem.h"
|
||||
#include "formeditorscene.h"
|
||||
#include "toolbox.h"
|
||||
#include <rewritertransaction.h>
|
||||
#include <modelnode.h>
|
||||
#include <itemlibraryinfo.h>
|
||||
@@ -641,6 +642,14 @@ void FormEditorView::actualStateChanged(const ModelNode &node)
|
||||
// m_currentTool->formEditorItemsChanged(itemList);
|
||||
}
|
||||
|
||||
Utils::CrumblePath *FormEditorView::crumblePath() const
|
||||
{
|
||||
if (widget() && widget()->toolBox()) {
|
||||
return widget()->toolBox()->crumblePath();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FormEditorView::reset()
|
||||
{
|
||||
QTimer::singleShot(200, this, SLOT(delayedReset()));
|
||||
|
||||
@@ -40,6 +40,10 @@ class QGraphicsScene;
|
||||
class QGraphicsSceneMouseEvent;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class CrumblePath;
|
||||
}
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class FormEditorWidget;
|
||||
@@ -118,6 +122,8 @@ public:
|
||||
|
||||
void actualStateChanged(const ModelNode &node);
|
||||
|
||||
Utils::CrumblePath *crumblePath() const;
|
||||
|
||||
protected:
|
||||
void reset();
|
||||
|
||||
|
||||
@@ -330,8 +330,8 @@ void DesignDocumentController::setCrumbleBarInfo(const CrumbleBarInfo &crumbleBa
|
||||
{
|
||||
DesignDocumentControllerPrivate::clearCrumblePath = false;
|
||||
DesignDocumentControllerPrivate::pushCrumblePath = false;
|
||||
while (!compareCrumbleBarInfo(d->formEditorView->widget()->toolBox()->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(), crumbleBarInfo))
|
||||
d->formEditorView->widget()->toolBox()->crumblePath()->popElement();
|
||||
while (!compareCrumbleBarInfo(d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(), crumbleBarInfo))
|
||||
d->formEditorView->crumblePath()->popElement();
|
||||
Core::EditorManager::instance()->openEditor(crumbleBarInfo.fileName);
|
||||
DesignDocumentControllerPrivate::pushCrumblePath = true;
|
||||
Internal::DesignModeWidget::instance()->currentDesignDocumentController()->changeToSubComponent(crumbleBarInfo.modelNode);
|
||||
@@ -448,10 +448,10 @@ void DesignDocumentController::changeCurrentModelTo(const ModelNode &node)
|
||||
if (Internal::DesignModeWidget::instance()->currentDesignDocumentController() != this)
|
||||
return;
|
||||
DesignDocumentControllerPrivate::clearCrumblePath = false;
|
||||
while (!d->formEditorView->widget()->toolBox()->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode())
|
||||
d->formEditorView->widget()->toolBox()->crumblePath()->popElement();
|
||||
while (!d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode())
|
||||
d->formEditorView->crumblePath()->popElement();
|
||||
if (node.isRootNode())
|
||||
d->formEditorView->widget()->toolBox()->crumblePath()->popElement();
|
||||
d->formEditorView->crumblePath()->popElement();
|
||||
changeToSubComponent(node);
|
||||
DesignDocumentControllerPrivate::clearCrumblePath = true;
|
||||
}
|
||||
@@ -568,12 +568,12 @@ void DesignDocumentController::loadCurrentModel()
|
||||
|
||||
|
||||
if (DesignDocumentControllerPrivate::clearCrumblePath)
|
||||
d->formEditorView->widget()->toolBox()->crumblePath()->clear();
|
||||
d->formEditorView->crumblePath()->clear();
|
||||
|
||||
if (DesignDocumentControllerPrivate::pushCrumblePath &&
|
||||
!compareCrumbleBarInfo(d->formEditorView->widget()->toolBox()->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(),
|
||||
!compareCrumbleBarInfo(d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(),
|
||||
createCrumbleBarInfo().value<CrumbleBarInfo>()))
|
||||
d->formEditorView->widget()->toolBox()->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
|
||||
d->formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
|
||||
|
||||
d->documentLoaded = true;
|
||||
Q_ASSERT(d->masterModel);
|
||||
|
||||
@@ -705,7 +705,7 @@ void DesignModeWidget::setup()
|
||||
m_statesEditorView = new StatesEditorView(this);
|
||||
|
||||
m_formEditorView = new FormEditorView(this);
|
||||
connect(m_formEditorView->widget()->toolBox()->crumblePath(), SIGNAL(elementClicked(QVariant)), this, SLOT(onCrumblePathElementClicked(QVariant)));
|
||||
connect(m_formEditorView->crumblePath(), SIGNAL(elementClicked(QVariant)), this, SLOT(onCrumblePathElementClicked(QVariant)));
|
||||
|
||||
m_componentView = new ComponentView(this);
|
||||
m_formEditorView->widget()->toolBox()->addLeftSideAction(m_componentView->action());
|
||||
|
||||
Reference in New Issue
Block a user