Merge pull request #1629 from HeyaGlitz/storagelegendfix
Fix storage page chart legend not respecting theme
This commit is contained in:
commit
aeac0eb9ba
@ -60,7 +60,9 @@ StoragePage::StoragePage(BaseInstance* inst, QWidget* parent) : QWidget(parent),
|
||||
m_chart->setBackgroundVisible(false);
|
||||
m_chart->setMargins(QMargins(0, 0, 0, 0));
|
||||
m_chart->legend()->setAlignment(Qt::AlignLeft);
|
||||
m_chart->legend()->setLabelColor(QApplication::palette().text().color());
|
||||
m_chart_view->setRenderHint(QPainter::Antialiasing);
|
||||
m_chart_view->installEventFilter(this);
|
||||
|
||||
ui->verticalLayout->addWidget(m_chart_view);
|
||||
ui->retranslateUi(this);
|
||||
@ -157,3 +159,13 @@ void StoragePage::updateCalculations()
|
||||
for (auto slice : m_series->slices())
|
||||
slice->setLabel(slice->label() + " " + QString("%1%").arg(100 * slice->percentage(), 0, 'f', 1));
|
||||
}
|
||||
|
||||
bool StoragePage::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::PaletteChange)
|
||||
{
|
||||
m_chart->legend()->setLabelColor(QApplication::palette().text().color());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -75,6 +75,9 @@ public:
|
||||
|
||||
void updateCalculations();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
|
||||
private:
|
||||
Ui::StoragePage *ui;
|
||||
BaseInstance *m_inst;
|
||||
|
Loading…
Reference in New Issue
Block a user