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 "formeditornodeinstanceview.h"
|
||||||
#include "formeditoritem.h"
|
#include "formeditoritem.h"
|
||||||
#include "formeditorscene.h"
|
#include "formeditorscene.h"
|
||||||
|
#include "toolbox.h"
|
||||||
#include <rewritertransaction.h>
|
#include <rewritertransaction.h>
|
||||||
#include <modelnode.h>
|
#include <modelnode.h>
|
||||||
#include <itemlibraryinfo.h>
|
#include <itemlibraryinfo.h>
|
||||||
@@ -641,6 +642,14 @@ void FormEditorView::actualStateChanged(const ModelNode &node)
|
|||||||
// m_currentTool->formEditorItemsChanged(itemList);
|
// m_currentTool->formEditorItemsChanged(itemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils::CrumblePath *FormEditorView::crumblePath() const
|
||||||
|
{
|
||||||
|
if (widget() && widget()->toolBox()) {
|
||||||
|
return widget()->toolBox()->crumblePath();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void FormEditorView::reset()
|
void FormEditorView::reset()
|
||||||
{
|
{
|
||||||
QTimer::singleShot(200, this, SLOT(delayedReset()));
|
QTimer::singleShot(200, this, SLOT(delayedReset()));
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ class QGraphicsScene;
|
|||||||
class QGraphicsSceneMouseEvent;
|
class QGraphicsSceneMouseEvent;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
class CrumblePath;
|
||||||
|
}
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class FormEditorWidget;
|
class FormEditorWidget;
|
||||||
@@ -118,6 +122,8 @@ public:
|
|||||||
|
|
||||||
void actualStateChanged(const ModelNode &node);
|
void actualStateChanged(const ModelNode &node);
|
||||||
|
|
||||||
|
Utils::CrumblePath *crumblePath() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|||||||
@@ -330,8 +330,8 @@ void DesignDocumentController::setCrumbleBarInfo(const CrumbleBarInfo &crumbleBa
|
|||||||
{
|
{
|
||||||
DesignDocumentControllerPrivate::clearCrumblePath = false;
|
DesignDocumentControllerPrivate::clearCrumblePath = false;
|
||||||
DesignDocumentControllerPrivate::pushCrumblePath = false;
|
DesignDocumentControllerPrivate::pushCrumblePath = false;
|
||||||
while (!compareCrumbleBarInfo(d->formEditorView->widget()->toolBox()->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(), crumbleBarInfo))
|
while (!compareCrumbleBarInfo(d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(), crumbleBarInfo))
|
||||||
d->formEditorView->widget()->toolBox()->crumblePath()->popElement();
|
d->formEditorView->crumblePath()->popElement();
|
||||||
Core::EditorManager::instance()->openEditor(crumbleBarInfo.fileName);
|
Core::EditorManager::instance()->openEditor(crumbleBarInfo.fileName);
|
||||||
DesignDocumentControllerPrivate::pushCrumblePath = true;
|
DesignDocumentControllerPrivate::pushCrumblePath = true;
|
||||||
Internal::DesignModeWidget::instance()->currentDesignDocumentController()->changeToSubComponent(crumbleBarInfo.modelNode);
|
Internal::DesignModeWidget::instance()->currentDesignDocumentController()->changeToSubComponent(crumbleBarInfo.modelNode);
|
||||||
@@ -448,10 +448,10 @@ void DesignDocumentController::changeCurrentModelTo(const ModelNode &node)
|
|||||||
if (Internal::DesignModeWidget::instance()->currentDesignDocumentController() != this)
|
if (Internal::DesignModeWidget::instance()->currentDesignDocumentController() != this)
|
||||||
return;
|
return;
|
||||||
DesignDocumentControllerPrivate::clearCrumblePath = false;
|
DesignDocumentControllerPrivate::clearCrumblePath = false;
|
||||||
while (!d->formEditorView->widget()->toolBox()->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode())
|
while (!d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode())
|
||||||
d->formEditorView->widget()->toolBox()->crumblePath()->popElement();
|
d->formEditorView->crumblePath()->popElement();
|
||||||
if (node.isRootNode())
|
if (node.isRootNode())
|
||||||
d->formEditorView->widget()->toolBox()->crumblePath()->popElement();
|
d->formEditorView->crumblePath()->popElement();
|
||||||
changeToSubComponent(node);
|
changeToSubComponent(node);
|
||||||
DesignDocumentControllerPrivate::clearCrumblePath = true;
|
DesignDocumentControllerPrivate::clearCrumblePath = true;
|
||||||
}
|
}
|
||||||
@@ -568,12 +568,12 @@ void DesignDocumentController::loadCurrentModel()
|
|||||||
|
|
||||||
|
|
||||||
if (DesignDocumentControllerPrivate::clearCrumblePath)
|
if (DesignDocumentControllerPrivate::clearCrumblePath)
|
||||||
d->formEditorView->widget()->toolBox()->crumblePath()->clear();
|
d->formEditorView->crumblePath()->clear();
|
||||||
|
|
||||||
if (DesignDocumentControllerPrivate::pushCrumblePath &&
|
if (DesignDocumentControllerPrivate::pushCrumblePath &&
|
||||||
!compareCrumbleBarInfo(d->formEditorView->widget()->toolBox()->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(),
|
!compareCrumbleBarInfo(d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(),
|
||||||
createCrumbleBarInfo().value<CrumbleBarInfo>()))
|
createCrumbleBarInfo().value<CrumbleBarInfo>()))
|
||||||
d->formEditorView->widget()->toolBox()->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
|
d->formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
|
||||||
|
|
||||||
d->documentLoaded = true;
|
d->documentLoaded = true;
|
||||||
Q_ASSERT(d->masterModel);
|
Q_ASSERT(d->masterModel);
|
||||||
|
|||||||
@@ -705,7 +705,7 @@ void DesignModeWidget::setup()
|
|||||||
m_statesEditorView = new StatesEditorView(this);
|
m_statesEditorView = new StatesEditorView(this);
|
||||||
|
|
||||||
m_formEditorView = new FormEditorView(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_componentView = new ComponentView(this);
|
||||||
m_formEditorView->widget()->toolBox()->addLeftSideAction(m_componentView->action());
|
m_formEditorView->widget()->toolBox()->addLeftSideAction(m_componentView->action());
|
||||||
|
|||||||
Reference in New Issue
Block a user