mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-12 11:55:44 -05:00
46 lines
933 B
C++
46 lines
933 B
C++
#ifndef SPECIESCHARTVIEW_H
|
|
#define SPECIESCHARTVIEW_H
|
|
|
|
#if QT_CHARTS_LIB
|
|
#include <QtCharts/QChartView>
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
QT_CHARTS_USE_NAMESPACE
|
|
#endif
|
|
|
|
class Project;
|
|
|
|
struct SpeciesEntry
|
|
{
|
|
QString name;
|
|
QPixmap icon;
|
|
};
|
|
|
|
class SpeciesChartView : public QChartView
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
static constexpr int IconSize = 32;
|
|
static constexpr int IconVerticalOffset = -2;
|
|
static constexpr int Spacing = 6;
|
|
static constexpr int Padding = 10;
|
|
static constexpr int MaxLabelWidth = 230;
|
|
explicit SpeciesChartView(QWidget *parent = nullptr);
|
|
|
|
void setSpecies(const QStringList &species);
|
|
void setProject(Project *project);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
private:
|
|
QVector<SpeciesEntry> m_speciesEntries;
|
|
Project *m_project = nullptr;
|
|
int m_maxTextWidth = 0;
|
|
};
|
|
|
|
#endif // __has_include(<QtCharts>)
|
|
|
|
#endif // SPECIESCHARTVIEW_H
|