1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4// W A R N I N G
5// -------------
6//
7// This file is not part of the Qt Chart API. It exists purely as an
8// implementation detail. This header file may change from version to
9// version without notice, or even be removed.
10//
11// We mean it.
12
13
14#ifndef LEGENDSCROLLER_P_H
15#define LEGENDSCROLLER_P_H
16
17#include <QtCharts/qlegend.h>
18#include <private/qlegend_p.h>
19#include <private/scroller_p.h>
20#include <QtCharts/private/qchartglobal_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class Q_CHARTS_PRIVATE_EXPORT LegendScroller: public QLegend, public Scroller
25{
26 Q_OBJECT
27
28public:
29 LegendScroller(QChart *chart);
30
31 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
32
33 void setOffset(const QPointF &point) override;
34 QPointF offset() const override;
35
36 void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
37 void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
38 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
39 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
40 void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
41 void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
42 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
43
44private:
45 void handleInteractiveChanged(bool interactive);
46 void updateForResizerChange();
47
48 bool m_forwardMouseEvents{false};
49 bool m_forwardHoverEvents{false};
50 bool m_cachedShouldShowMoveEvents{false};
51
52private slots:
53 void handleDetached(bool attached);
54};
55
56QT_END_NAMESPACE
57
58#endif
59

source code of qtcharts/src/charts/legend/legendscroller_p.h