mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-26 02:26:17 -05:00
redesign species distribution
This commit is contained in:
37
include/ui/specieschartview.h
Normal file
37
include/ui/specieschartview.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef SPECIESCHARTVIEW_H
|
||||
#define SPECIESCHARTVIEW_H
|
||||
|
||||
#include <QtCharts/QChartView>
|
||||
|
||||
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
|
||||
@@ -8,6 +8,8 @@
|
||||
#if __has_include(<QtCharts>)
|
||||
#include <QtCharts>
|
||||
|
||||
class Project;
|
||||
|
||||
namespace Ui {
|
||||
class WildMonChart;
|
||||
}
|
||||
@@ -16,7 +18,7 @@ class WildMonChart : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WildMonChart(QWidget *parent, const EncounterTableModel *table);
|
||||
explicit WildMonChart(QWidget *parent, const EncounterTableModel *table, Project *project);
|
||||
~WildMonChart();
|
||||
|
||||
public slots:
|
||||
@@ -27,6 +29,7 @@ public slots:
|
||||
private:
|
||||
Ui::WildMonChart *ui;
|
||||
const EncounterTableModel *table;
|
||||
Project *project = nullptr;
|
||||
|
||||
QStringList groupNames;
|
||||
QStringList groupNamesReversed;
|
||||
|
||||
Reference in New Issue
Block a user