1// Copyright (C) 2016 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 PERCENTBARCHARTITEM_H
15#define PERCENTBARCHARTITEM_H
16
17#include <private/abstractbarchartitem_p.h>
18#include <QtWidgets/QGraphicsItem>
19#include <QtCharts/private/qchartglobal_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QAbstractBarSeries;
24
25class Q_CHARTS_PRIVATE_EXPORT PercentBarChartItem : public AbstractBarChartItem
26{
27 Q_OBJECT
28public:
29 PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
30 QString generateLabelText(int set, int category, qreal value) override;
31
32private Q_SLOTS:
33 void handleLabelsPositionChanged();
34 void positionLabels() override;
35
36private:
37 QList<QRectF> calculateLayout() override;
38 void initializeLayout(int set, int category, int layoutIndex, bool resetAnimation) override;
39 void markLabelsDirty(QBarSet *barset, int index, int count) override;
40 QPointF topLeftPoint(int category, qreal barWidth, qreal value);
41 QPointF bottomRightPoint(int category, qreal barWidth, qreal value);
42};
43
44QT_END_NAMESPACE
45
46#endif // PERCENTBARCHARTITEM_H
47

source code of qtcharts/src/charts/barchart/vertical/percent/percentbarchartitem_p.h