Skip to content

Commit

Permalink
IMPROVED: JKQTPGraphsModel generated High-DPI Icons, if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
jkriege2 committed Dec 22, 2023
1 parent 4017852 commit d4930d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/jkqtplotter/gui/jkqtpgraphsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "jkqtplotter/gui/jkqtpgraphsmodel.h"
#include "jkqtplotter/jkqtpbaseplotter.h"
#include <QGuiApplication>
#include "jkqtplotter/jkqtptools.h"
#include "jkqtplotter/graphs/jkqtpscatter.h"
#include <QImage>
Expand Down Expand Up @@ -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;
} else if (role == Qt::DecorationRole) {
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));
}
}
Expand Down

0 comments on commit d4930d7

Please sign in to comment.