Moved CrumblePath to Utils

This widget has little to do with the QML debugging library, and will be
reused inside the QML JS Inspector UI as well.
This commit is contained in:
Lasse Holmstedt
2010-07-30 16:09:17 +02:00
parent f4b1c441aa
commit 8918cff941
13 changed files with 54 additions and 58 deletions

View File

@@ -2,7 +2,6 @@
#include "qdeclarativedesignview.h"
#include "subcomponentmasklayeritem.h"
#include "layeritem.h"
#include "crumblepath.h"
#include <QGraphicsItem>
#include <QGraphicsObject>
@@ -20,8 +19,7 @@ const qreal MaxOpacity = 0.5f;
SubcomponentEditorTool::SubcomponentEditorTool(QDeclarativeDesignView *view)
: AbstractFormEditorTool(view),
m_animIncrement(0.05f),
m_animTimer(new QTimer(this)),
m_crumblePathWidget(0)
m_animTimer(new QTimer(this))
{
m_mask = new SubcomponentMaskLayerItem(view, view->manipulatorLayer());
connect(m_animTimer, SIGNAL(timeout()), SLOT(animate()));
@@ -125,8 +123,7 @@ void SubcomponentEditorTool::clear()
m_animTimer->stop();
m_mask->hide();
if (m_crumblePathWidget)
m_crumblePathWidget->clear();
emit cleared();
}
void SubcomponentEditorTool::graphicsObjectsChanged(const QList<QGraphicsObject*> &/*itemList*/)
@@ -230,8 +227,7 @@ void SubcomponentEditorTool::pushContext(QGraphicsObject *contextItem)
{
connect(contextItem, SIGNAL(destroyed(QObject*)), SLOT(contextDestroyed(QObject*)));
m_currentContext.push(contextItem);
if (m_crumblePathWidget)
m_crumblePathWidget->pushElement(titleForItem(contextItem));
emit contextPushed(titleForItem(contextItem));
}
void SubcomponentEditorTool::aboutToPopContext()
@@ -248,8 +244,7 @@ QGraphicsObject *SubcomponentEditorTool::popContext()
{
QGraphicsObject *popped = m_currentContext.pop();
if (m_crumblePathWidget)
m_crumblePathWidget->popElement();
emit contextPopped();
disconnect(popped, SIGNAL(xChanged()), this, SLOT(refresh()));
disconnect(popped, SIGNAL(yChanged()), this, SLOT(refresh()));
@@ -285,24 +280,13 @@ void SubcomponentEditorTool::contextDestroyed(QObject *contextToDestroy)
// pop out the whole context - it might not be safe anymore.
while (m_currentContext.size() > 1) {
m_currentContext.pop();
if (m_crumblePathWidget)
m_crumblePathWidget->popElement();
emit contextPopped();
}
m_mask->setVisible(false);
}
void SubcomponentEditorTool::setCrumblePathWidget(CrumblePath *pathWidget)
{
m_crumblePathWidget = pathWidget;
if (m_crumblePathWidget) {
connect(m_crumblePathWidget, SIGNAL(elementClicked(int)), SLOT(setContext(int)));
connect(m_crumblePathWidget, SIGNAL(elementContextMenuRequested(int)), SLOT(openContextMenuForContext(int)));
}
}
void SubcomponentEditorTool::setContext(int contextIndex)
{
Q_ASSERT(contextIndex >= 0);
@@ -317,10 +301,5 @@ void SubcomponentEditorTool::setContext(int contextIndex)
}
}
void SubcomponentEditorTool::openContextMenuForContext(int /*contextIndex*/)
{
}
} // namespace QmlViewer