Fix drawing of the outer frame of Qml item

This commit is contained in:
Marco Bubke
2010-01-07 15:18:13 +01:00
parent af64744706
commit efa2482da9
2 changed files with 6 additions and 6 deletions

View File

@@ -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;
}

View File

@@ -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);
}