Files
qt-creator/src/libs/qmlpuppetcommunication/container/imagecontainer.h
Thomas Hartmann 2a44f8caaf QmlDesigner: Fix shaking items when scrubbing the timeline
The reason for this is that when scrubbing the timeline,
the bounding rectangle can change a lot (See bugreport).
If this is the case the pixmap and the bounding rectangle get temporarily
out of sync, which leads to the shaking.
In this patch we add the bounding rectangle to the pixmap command.
The bounding rectangle coming with the pixmap has higher precedence.
This means if there is a pixmap, then the pixmap is always in sync with
the pixmap. If there is no pixmap we use the "original" bounding rectangle.

Task-number: QDS-7828
Change-Id: I40c0b7ed97863b9dca726547927ae1a37f9c415d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2022-11-16 17:51:28 +00:00

49 lines
1.4 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include <QImage>
#include <QMetaType>
#include <QRectF>
namespace QmlDesigner {
class ImageContainer
{
friend QDataStream &operator>>(QDataStream &in, ImageContainer &container);
friend bool operator==(const ImageContainer &first, const ImageContainer &second);
friend bool operator<(const ImageContainer &first, const ImageContainer &second);
public:
ImageContainer();
ImageContainer(qint32 instanceId, const QImage &image, qint32 keyNumber);
qint32 instanceId() const;
QImage image() const;
qint32 keyNumber() const;
QRectF rect() const;
void setImage(const QImage &image);
void setRect(const QRectF &rectangle);
static void removeSharedMemorys(const QVector<qint32> &keyNumberVector);
private:
QImage m_image;
qint32 m_instanceId;
qint32 m_keyNumber;
QRectF m_rect;
};
QDataStream &operator<<(QDataStream &out, const ImageContainer &container);
QDataStream &operator>>(QDataStream &in, ImageContainer &container);
bool operator==(const ImageContainer &first, const ImageContainer &second);
bool operator<(const ImageContainer &first, const ImageContainer &second);
QDebug operator<<(QDebug debug, const ImageContainer &container);
} // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::ImageContainer)