Commit efa2482d authored by Marco Bubke's avatar Marco Bubke

Fix drawing of the outer frame of Qml item

parent af647447
......@@ -63,7 +63,7 @@ FormEditorItem::FormEditorItem(const QmlItemNode &qmlItemNode, FormEditorScene*
m_borderWidth(1.0),
m_opacity(0.6)
{
setCacheMode(QGraphicsItem::ItemCoordinateCache);
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
setup();
}
......@@ -182,7 +182,7 @@ static QRectF alignedRect(const QRectF &rect)
alignedRect.setTop(std::floor(rect.top()) + 0.5);
alignedRect.setBottom(std::floor(rect.bottom()) + 0.5);
alignedRect.setLeft(std::floor(rect.left()) + 0.5);
alignedRect.setRight(std::floor(rect.right()) + 0.5);
alignedRect.setRight(std::floor(rect.right()) + 1.5);
return alignedRect;
}
......
......@@ -87,8 +87,8 @@ void SelectionIndicator::setItems(const QList<FormEditorItem*> &itemList)
foreach (FormEditorItem *item, itemList) {
QGraphicsPolygonItem *newSelectionIndicatorGraphicsItem = new QGraphicsPolygonItem(m_layerItem.data());
m_indicatorShapeHash.insert(item, newSelectionIndicatorGraphicsItem);
QPolygonF boundingRectInSceneSpace(item->mapToScene(item->qmlItemNode().instanceBoundingRect()));
alignVertices(boundingRectInSceneSpace, 0.5 / item->formEditorView()->widget()->zoomAction()->zoomLevel());
QPolygonF boundingRectInSceneSpace(item->mapToScene(item->qmlItemNode().instanceBoundingRect().adjusted(0.5, 0.5, 0.5, 0.5)));
// alignVertices(boundingRectInSceneSpace, 0.5 / item->formEditorView()->widget()->zoomAction()->zoomLevel());
QPolygonF boundingRectInLayerItemSpace = m_layerItem->mapFromScene(boundingRectInSceneSpace);
newSelectionIndicatorGraphicsItem->setPolygon(boundingRectInLayerItemSpace);
newSelectionIndicatorGraphicsItem->setFlag(QGraphicsItem::ItemIsSelectable, false);
......@@ -106,8 +106,8 @@ void SelectionIndicator::updateItems(const QList<FormEditorItem*> &itemList)
foreach (FormEditorItem *item, itemList) {
if (m_indicatorShapeHash.contains(item)) {
QGraphicsPolygonItem *indicatorGraphicsItem = m_indicatorShapeHash.value(item);
QPolygonF boundingRectInSceneSpace(item->mapToScene(item->qmlItemNode().instanceBoundingRect()));
alignVertices(boundingRectInSceneSpace, 0.5 / item->formEditorView()->widget()->zoomAction()->zoomLevel());
QPolygonF boundingRectInSceneSpace(item->mapToScene(item->qmlItemNode().instanceBoundingRect().adjusted(0.5, 0.5, 0.5, 0.5)));
// alignVertices(boundingRectInSceneSpace, 0.5 / item->formEditorView()->widget()->zoomAction()->zoomLevel());
QPolygonF boundingRectInLayerItemSpace = m_layerItem->mapFromScene(boundingRectInSceneSpace);
indicatorGraphicsItem->setPolygon(boundingRectInLayerItemSpace);
}
......
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