mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2025-01-12 17:00:32 +08:00
IMPROVED: JKQTPGraphsModel generated High-DPI Icons, if necessary
This commit is contained in:
parent
4017852df4
commit
d4930d7729
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "jkqtplotter/gui/jkqtpgraphsmodel.h"
|
#include "jkqtplotter/gui/jkqtpgraphsmodel.h"
|
||||||
#include "jkqtplotter/jkqtpbaseplotter.h"
|
#include "jkqtplotter/jkqtpbaseplotter.h"
|
||||||
|
#include <QGuiApplication>
|
||||||
#include "jkqtplotter/jkqtptools.h"
|
#include "jkqtplotter/jkqtptools.h"
|
||||||
#include "jkqtplotter/graphs/jkqtpscatter.h"
|
#include "jkqtplotter/graphs/jkqtpscatter.h"
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
@ -51,6 +52,10 @@ QVariant JKQTPGraphsModel::data(const QModelIndex &index, int role) const
|
|||||||
if (index.row()<static_cast<int>(m_plotter->getGraphCount())) return m_plotter->getGraph(static_cast<size_t>(index.row()))->isVisible()?Qt::Checked:Qt::Unchecked;
|
if (index.row()<static_cast<int>(m_plotter->getGraphCount())) return m_plotter->getGraph(static_cast<size_t>(index.row()))->isVisible()?Qt::Checked:Qt::Unchecked;
|
||||||
} else if (role == Qt::DecorationRole) {
|
} else if (role == Qt::DecorationRole) {
|
||||||
if (index.row()<static_cast<int>(m_plotter->getGraphCount())) {
|
if (index.row()<static_cast<int>(m_plotter->getGraphCount())) {
|
||||||
|
const qreal dpr = qGuiApp->devicePixelRatio();
|
||||||
|
QPixmap pix=QPixmap::fromImage(m_plotter->getGraph(static_cast<size_t>(index.row()))->generateKeyMarker(QSize(16,16)*dpr));
|
||||||
|
pix.setDevicePixelRatio(dpr);
|
||||||
|
|
||||||
return m_plotter->getGraph(static_cast<size_t>(index.row()))->generateKeyMarker(QSize(16,16));
|
return m_plotter->getGraph(static_cast<size_t>(index.row()))->generateKeyMarker(QSize(16,16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user