mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-12 03:45:51 -05:00
42 lines
836 B
C++
42 lines
836 B
C++
#ifndef SPECIESCHARTVIEW_H
|
|
#define SPECIESCHARTVIEW_H
|
|
|
|
#if QT_CHARTS_LIB
|
|
#include <QtCharts/QChartView>
|
|
QT_CHARTS_USE_NAMESPACE
|
|
|
|
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;
|
|
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
|