mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 10:01:38 +08:00
JKQTPlotter: generate High-DPI Icons, where necessary/appropriate
This commit is contained in:
parent
2a70ec6260
commit
9b5549b8b5
@ -102,13 +102,15 @@ void JKQTPSymbolComboBox::setCurrentSymbol(JKQTPGraphSymbols symbol)
|
||||
|
||||
void JKQTPSymbolComboBox::addSymbol(JKQTPGraphSymbols symbol, const QString &name)
|
||||
{
|
||||
QPixmap pix(12,12);
|
||||
const qreal dpr = devicePixelRatioF();
|
||||
QPixmap pix(12*dpr,12*dpr);
|
||||
pix.setDevicePixelRatio(dpr);
|
||||
pix.fill(Qt::transparent);
|
||||
JKQTPEnhancedPainter p;
|
||||
p.begin(&pix);
|
||||
p.setRenderHint(JKQTPEnhancedPainter::Antialiasing);
|
||||
p.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing);
|
||||
JKQTPPlotSymbol(p, 6,6,symbol,10,1,QColor("blue"), QColor("blue").lighter());
|
||||
JKQTPPlotSymbol(p, 6.0*dpr,6.0*dpr,symbol,10.0*dpr,1,QColor("blue"), QColor("blue").lighter());
|
||||
p.end();
|
||||
addItem(QIcon(pix), name, JKQTPGraphSymbols2String(symbol));
|
||||
}
|
||||
@ -176,15 +178,17 @@ void JKQTPLinePlotStyleComboBox::refill()
|
||||
|
||||
void JKQTPLinePlotStyleComboBox::addSymbol(JKQTPGraphSymbols symbol, bool line, const QString &name, const QVariant &data)
|
||||
{
|
||||
QPixmap pix(12,12);
|
||||
const qreal dpr = devicePixelRatioF();
|
||||
QPixmap pix(12*dpr,12*dpr);
|
||||
pix.setDevicePixelRatio(dpr);
|
||||
pix.fill(Qt::transparent);
|
||||
JKQTPEnhancedPainter p;
|
||||
p.begin(&pix);
|
||||
p.setRenderHint(JKQTPEnhancedPainter::Antialiasing);
|
||||
p.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing);
|
||||
JKQTPPlotSymbol(p, 6,6,symbol,7,1,QColor("blue"), QColor("blue").lighter());
|
||||
JKQTPPlotSymbol(p, 6.0*dpr,6.0*dpr,symbol,7.0*dpr,1,QColor("blue"), QColor("blue").lighter());
|
||||
p.setPen(QColor("blue"));
|
||||
if (line) p.drawLine(0,6,12,6);
|
||||
if (line) p.drawLine(0,6*dpr,12*dpr,6*dpr);
|
||||
p.end();
|
||||
addItem(QIcon(pix), name, data);
|
||||
}
|
||||
@ -492,8 +496,10 @@ void JKQTPLinePlotStyleWithSymbolSizeComboBox::refill()
|
||||
|
||||
void JKQTPLinePlotStyleWithSymbolSizeComboBox::addSymbol(JKQTPGraphSymbols symbol, bool line, double symbolSize, const QString &name, const QVariant &data)
|
||||
{
|
||||
int pixSize=qMax(16.0, 1.2*symbolSize);
|
||||
const qreal dpr = devicePixelRatioF();
|
||||
int pixSize=qMax(16.0, 1.2*symbolSize)*dpr;
|
||||
QPixmap pix(pixSize, pixSize);
|
||||
pix.setDevicePixelRatio(dpr);
|
||||
pix.fill(Qt::transparent);
|
||||
JKQTPEnhancedPainter p;
|
||||
p.begin(&pix);
|
||||
|
@ -89,7 +89,9 @@ JKQTPlotter::JKQTPlotter(bool datastore_internal, QWidget* parent, JKQTPDatastor
|
||||
connect(plotter, SIGNAL(beforePlotScalingRecalculate()), this, SLOT(intBeforePlotScalingRecalculate()));
|
||||
connect(plotter, SIGNAL(zoomChangedLocally(double, double, double, double, JKQTBasePlotter*)), this, SLOT(pzoomChangedLocally(double, double, double, double, JKQTBasePlotter*)));
|
||||
|
||||
image=QImage(width(), height(), QImage::Format_ARGB32);
|
||||
const qreal dpr = devicePixelRatioF();
|
||||
image=QImage(width()*dpr, height()*dpr, QImage::Format_ARGB32);
|
||||
image.setDevicePixelRatio(dpr);
|
||||
oldImage=image;
|
||||
|
||||
// enable mouse-tracking, so mouseMoved-Events can be caught
|
||||
@ -1116,7 +1118,10 @@ void JKQTPlotter::initContextMenu()
|
||||
QAction* act=new QAction(tit, menVisibleGroup);
|
||||
act->setCheckable(true);
|
||||
act->setChecked(getPlotter()->getGraph(i)->isVisible());
|
||||
act->setIcon(QIcon(QPixmap::fromImage(getPlotter()->getGraph(i)->generateKeyMarker(QSize(16,16)))));
|
||||
const qreal dpr = devicePixelRatioF();
|
||||
QPixmap pix=QPixmap::fromImage(getPlotter()->getGraph(i)->generateKeyMarker(QSize(16,16)*dpr));
|
||||
pix.setDevicePixelRatio(dpr);
|
||||
act->setIcon(QIcon(pix));
|
||||
act->setData(static_cast<int>(i));
|
||||
connect(act, SIGNAL(toggled(bool)), this, SLOT(reactGraphVisible(bool)));
|
||||
menVisibleGroup->addAction(act);
|
||||
|
Loading…
Reference in New Issue
Block a user