diff --git a/utils/fgqcanvas/canvasconnection.cpp b/utils/fgqcanvas/canvasconnection.cpp index c2aef0626..dba1bb7bf 100644 --- a/utils/fgqcanvas/canvasconnection.cpp +++ b/utils/fgqcanvas/canvasconnection.cpp @@ -190,7 +190,6 @@ FGQCanvasFontCache *CanvasConnection::fontCache() const void CanvasConnection::onWebSocketConnected() { - qDebug() << Q_FUNC_INFO; m_localPropertyRoot.reset(new LocalProp{nullptr, NameIndexTuple("")}); setStatus(Connected); } diff --git a/utils/fgqcanvas/canvasdisplay.cpp b/utils/fgqcanvas/canvasdisplay.cpp index 54dd73928..946ba3f39 100644 --- a/utils/fgqcanvas/canvasdisplay.cpp +++ b/utils/fgqcanvas/canvasdisplay.cpp @@ -29,14 +29,12 @@ CanvasDisplay::CanvasDisplay(QQuickItem* parent) : QQuickItem(parent) { - qDebug() << "created a canvas display"; - + setTransformOrigin(QQuickItem::TopLeft); setFlag(ItemHasContents); } CanvasDisplay::~CanvasDisplay() { - qDebug() << Q_FUNC_INFO << "connection is" << m_connection; delete m_rootItem; } @@ -109,8 +107,9 @@ void CanvasDisplay::onConnectionStatusChanged() m_rootItem = m_rootElement->createQuickItem(this); onCanvasSizeChanged(); - m_connection->propertyRoot()->recursiveNotifyRestored(); - qDebug() << Q_FUNC_INFO << "did build item tree"; + if (m_connection->status() == CanvasConnection::Snapshot) { + m_connection->propertyRoot()->recursiveNotifyRestored(); + } } } @@ -124,8 +123,9 @@ void CanvasDisplay::onConnectionUpdated() void CanvasDisplay::onCanvasSizeChanged() { - m_sourceSize = QSizeF(m_connection->propertyRoot()->value("size", 400).toDouble(), - m_connection->propertyRoot()->value("size[1]", 400).toDouble()); + m_sourceSize = QSizeF(m_connection->propertyRoot()->value("size", 256).toDouble(), + m_connection->propertyRoot()->value("size[1]", 256).toDouble()); + setImplicitSize(m_sourceSize.width(), m_sourceSize.height()); recomputeScaling(); } diff --git a/utils/fgqcanvas/qml/CanvasFrame.qml b/utils/fgqcanvas/qml/CanvasFrame.qml index c5b35e23d..3b7d0887c 100644 --- a/utils/fgqcanvas/qml/CanvasFrame.qml +++ b/utils/fgqcanvas/qml/CanvasFrame.qml @@ -7,8 +7,6 @@ Item { property alias canvas: canvasDisplay.canvas property bool showUi: true - //clip: true; - Component.onCompleted: { if (canvas) { width = canvas.size.width @@ -24,16 +22,22 @@ Item { canvas.size = Qt.size(root.width, root.height); } - FG.CanvasDisplay { - id: canvasDisplay + Item { + id: clipShell anchors.fill: parent + clip: true - onCanvasChanged: { - if (canvas) { - root.width = canvas.size.width - root.height = canvas.size.height - root.x = canvas.origin.x - root.y = canvas.origin.y + FG.CanvasDisplay { + id: canvasDisplay + anchors.fill: parent + + onCanvasChanged: { + if (canvas) { + root.width = canvas.size.width + root.height = canvas.size.height + root.x = canvas.origin.x + root.y = canvas.origin.y + } } } }