Commit d875953d authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Refresh context area mask when the context object size changes

parent 8e8581a2
......@@ -143,6 +143,12 @@ void SubcomponentEditorTool::setCurrentItem(QGraphicsItem* contextItem)
if (!gfxObject)
return;
connect(gfxObject, SIGNAL(xChanged()), SLOT(refresh()));
connect(gfxObject, SIGNAL(yChanged()), SLOT(refresh()));
connect(gfxObject, SIGNAL(scaleChanged()), SLOT(refresh()));
connect(gfxObject, SIGNAL(widthChanged()), SLOT(refresh()));
connect(gfxObject, SIGNAL(heightChanged()), SLOT(refresh()));
//QString parentClassName = gfxObject->metaObject()->className();
//if (parentClassName.contains(QRegExp("_QMLTYPE_\\d+")))
......@@ -234,6 +240,13 @@ void SubcomponentEditorTool::aboutToPopContext()
QGraphicsObject *SubcomponentEditorTool::popContext()
{
QGraphicsObject *popped = m_currentContext.pop();
disconnect(popped, SIGNAL(xChanged()), this, SLOT(refresh()));
disconnect(popped, SIGNAL(yChanged()), this, SLOT(refresh()));
disconnect(popped, SIGNAL(scaleChanged()), this, SLOT(refresh()));
disconnect(popped, SIGNAL(widthChanged()), this, SLOT(refresh()));
disconnect(popped, SIGNAL(heightChanged()), this, SLOT(refresh()));
if (m_currentContext.size() > 1) {
m_mask->setCurrentItem(m_currentContext.top());
m_mask->setOpacity(MaxOpacity);
......@@ -243,6 +256,11 @@ QGraphicsObject *SubcomponentEditorTool::popContext()
return popped;
}
void SubcomponentEditorTool::refresh()
{
m_mask->setCurrentItem(m_currentContext.top());
}
QGraphicsObject *SubcomponentEditorTool::currentRootItem() const
{
return m_currentContext.top();
......
......@@ -58,6 +58,7 @@ protected:
private slots:
void animate();
void contextDestroyed(QObject *context);
void refresh();
private:
void aboutToPopContext();
......
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