From d4930d77290cc807201e635b165794444c83fa49 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Fri, 22 Dec 2023 21:09:41 +0100 Subject: [PATCH] IMPROVED: JKQTPGraphsModel generated High-DPI Icons, if necessary --- lib/jkqtplotter/gui/jkqtpgraphsmodel.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/jkqtplotter/gui/jkqtpgraphsmodel.cpp b/lib/jkqtplotter/gui/jkqtpgraphsmodel.cpp index 2dcefcfc36..71a205a4ab 100644 --- a/lib/jkqtplotter/gui/jkqtpgraphsmodel.cpp +++ b/lib/jkqtplotter/gui/jkqtpgraphsmodel.cpp @@ -21,6 +21,7 @@ #include "jkqtplotter/gui/jkqtpgraphsmodel.h" #include "jkqtplotter/jkqtpbaseplotter.h" +#include #include "jkqtplotter/jkqtptools.h" #include "jkqtplotter/graphs/jkqtpscatter.h" #include @@ -51,6 +52,10 @@ QVariant JKQTPGraphsModel::data(const QModelIndex &index, int role) const if (index.row()(m_plotter->getGraphCount())) return m_plotter->getGraph(static_cast(index.row()))->isVisible()?Qt::Checked:Qt::Unchecked; } else if (role == Qt::DecorationRole) { if (index.row()(m_plotter->getGraphCount())) { + const qreal dpr = qGuiApp->devicePixelRatio(); + QPixmap pix=QPixmap::fromImage(m_plotter->getGraph(static_cast(index.row()))->generateKeyMarker(QSize(16,16)*dpr)); + pix.setDevicePixelRatio(dpr); + return m_plotter->getGraph(static_cast(index.row()))->generateKeyMarker(QSize(16,16)); } }