aboutsummaryrefslogtreecommitdiffstats
path: root/stats/informationbox.h
blob: 0c71447aa1e6dbd7a3b329a8b3139ba3f2276e92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: GPL-2.0
// A small box displaying statistics information, notably
// for a scatter-plot item or a bar in a bar chart.
#ifndef INFORMATION_BOX_H
#define INFORMATION_BOX_H

#include "backend-shared/roundrectitem.h"

#include <vector>
#include <memory>
#include <QFont>

namespace QtCharts {
	class QChart;
}
struct dive;

// Information window showing data of highlighted dive
struct InformationBox : RoundRectItem {
	InformationBox(QtCharts::QChart *chart);
	void setText(const std::vector<QString> &text, QPointF pos);
	void setPos(QPointF pos);
	int recommendedMaxLines() const;
private:
	QtCharts::QChart *chart;
	QFont font; // For future specialization.
	double width, height;
	void addLine(const QString &s);
	std::vector<std::unique_ptr<QGraphicsSimpleTextItem>> textItems;
};

#endif