Commit 3a0d71ce authored by Marco Bubke's avatar Marco Bubke Committed by Kai Koehne

Fix opacity bug in the formeditor

Task-Id: BAUHAUS-427
parent 5f268d95
......@@ -61,7 +61,6 @@ FormEditorItem::FormEditorItem(const QmlItemNode &qmlItemNode, FormEditorScene*
m_snappingLineCreator(this),
m_qmlItemNode(qmlItemNode),
m_borderWidth(1.0),
m_opacity(0.6),
m_highlightBoundingRect(false)
{
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
......@@ -70,8 +69,10 @@ FormEditorItem::FormEditorItem(const QmlItemNode &qmlItemNode, FormEditorScene*
void FormEditorItem::setup()
{
if (qmlItemNode().hasInstanceParent())
if (qmlItemNode().hasInstanceParent()) {
setParentItem(scene()->itemForQmlItemNode(qmlItemNode().instanceParent().toQmlItemNode()));
setOpacity(qmlItemNode().instanceValue("opacity").toDouble());
}
if (QGraphicsItem::parentItem() == scene()->formLayerItem())
m_borderWidth = 0.0;
......@@ -152,7 +153,6 @@ void FormEditorItem::setAttentionScale(double sinusScale)
void FormEditorItem::setAttentionHighlight(double value)
{
m_opacity = 0.6 + value;
if (QGraphicsItem::parentItem() == scene()->formLayerItem())
m_borderWidth = value * 4;
else
......@@ -245,14 +245,6 @@ void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);
switch(scene()->paintMode()) {
case FormEditorScene::AnchorMode:
painter->setOpacity(m_opacity);
break;
case FormEditorScene::NormalMode:
painter->setOpacity(qmlItemNode().instanceValue("opacity").toDouble());
break;
}
qmlItemNode().paintInstance(painter);
......
......@@ -121,7 +121,6 @@ private: // variables
QTransform m_inverseAttentionTransform;
QRectF m_boundingRect;
double m_borderWidth;
double m_opacity;
bool m_highlightBoundingRect;
};
......
......@@ -158,10 +158,14 @@ void FormEditorScene::synchronizeParent(const QmlItemNode &qmlItemNode)
reparentItem(qmlItemNode, parentNode);
}
void FormEditorScene::synchronizeOtherProperty(const QmlItemNode &qmlItemNode)
void FormEditorScene::synchronizeOtherProperty(const QmlItemNode &qmlItemNode, const QString &propertyName)
{
if (hasItemForQmlItemNode(qmlItemNode)) {
FormEditorItem *item = itemForQmlItemNode(qmlItemNode);
if (propertyName == "opacity")
item->setOpacity(qmlItemNode.instanceValue("opacity").toDouble());
if (item)
item->update();
}
......
......@@ -76,7 +76,7 @@ public:
void synchronizeTransformation(const QmlItemNode &qmlItemNode);
void synchronizeParent(const QmlItemNode &qmlItemNode);
void synchronizeOtherProperty(const QmlItemNode &qmlItemNode);
void synchronizeOtherProperty(const QmlItemNode &qmlItemNode, const QString &propertyName);
void synchronizeState(const QmlItemNode &qmlItemNode);
FormEditorItem* calulateNewParent(FormEditorItem *widget);
......
......@@ -523,14 +523,14 @@ void FormEditorView::parentChanged(const QmlObjectNode &qmlObjectNode)
}
}
void FormEditorView::otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &/*propertyName*/)
void FormEditorView::otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName)
{
Q_ASSERT(qmlObjectNode.isValid());
QmlItemNode itemNode = findRecursiveQmlItemNode(qmlObjectNode);
if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) {
m_scene->synchronizeOtherProperty(itemNode);
m_scene->synchronizeOtherProperty(itemNode, propertyName);
m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode));
}
}
......
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