2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef CUSTOMPROXY_H
|
|
|
|
#define CUSTOMPROXY_H
|
|
|
|
|
2012-11-23 08:31:03 +00:00
|
|
|
#include <QTimeLine>
|
|
|
|
#include <QGraphicsProxyWidget>
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
class CustomProxy : public QGraphicsProxyWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2012-11-23 08:31:03 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
public:
|
2019-11-18 16:01:26 +00:00
|
|
|
explicit CustomProxy(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = { });
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-06-15 08:12:35 +00:00
|
|
|
QRectF boundingRect() const override;
|
2011-04-27 10:05:43 +00:00
|
|
|
void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
2016-06-15 08:12:35 +00:00
|
|
|
QWidget *widget) override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 08:12:35 +00:00
|
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
|
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
|
|
|
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override;
|
|
|
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void updateStep(qreal step);
|
|
|
|
void stateChanged(QTimeLine::State);
|
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QTimeLine *timeLine;
|
2019-09-01 15:12:01 +00:00
|
|
|
QGraphicsItem *currentPopup = nullptr;
|
|
|
|
bool popupShown = false;
|
2011-04-27 10:05:43 +00:00
|
|
|
};
|
|
|
|
|
2012-11-23 08:31:03 +00:00
|
|
|
#endif // CUSTOMPROXY_H
|