forked from qt-creator/qt-creator
QmlDesigner: Add viewportTransform() to LayerItem
Change-Id: Ia90ae0a079922b3c1cdd429ee0f6e337c59267a5 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
|
||||
#include <formeditorscene.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
@@ -54,6 +57,14 @@ QList<QGraphicsItem*> LayerItem::findAllChildItems() const
|
||||
return findAllChildItems(this);
|
||||
}
|
||||
|
||||
QTransform LayerItem::viewportTransform() const
|
||||
{
|
||||
QTC_ASSERT(scene(), return {});
|
||||
QTC_ASSERT(!scene()->views().isEmpty(), return {});
|
||||
|
||||
return scene()->views().first()->viewportTransform();
|
||||
}
|
||||
|
||||
QList<QGraphicsItem*> LayerItem::findAllChildItems(const QGraphicsItem *item) const
|
||||
{
|
||||
QList<QGraphicsItem*> itemList(item->childItems());
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QGraphicsObject>
|
||||
#include <QTransform>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
@@ -45,6 +46,8 @@ public:
|
||||
|
||||
QList<QGraphicsItem*> findAllChildItems() const;
|
||||
|
||||
QTransform viewportTransform() const;
|
||||
|
||||
protected:
|
||||
QList<QGraphicsItem*> findAllChildItems(const QGraphicsItem *item) const;
|
||||
};
|
||||
|
Reference in New Issue
Block a user