Merge pull request #55 from akenmorris/high_dpi

Enable high-dpi support for plots
This commit is contained in:
Jan W. Krieger 2022-04-15 22:55:35 +02:00 committed by GitHub
commit 8f184791cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1236,8 +1236,9 @@ void JKQTPlotter::resizeEvent(QResizeEvent *event) {
void JKQTPlotter::delayedResizeEvent()
{
int plotImageWidth=width();
int plotImageHeight=height();
qreal dpr = devicePixelRatioF();
int plotImageWidth=width() * dpr;
int plotImageHeight=height() * dpr;
plotImageHeight=plotImageHeight-getPlotYOffset();
//qDebug()<<"resize: "<<plotImageWidth<<" x "<<plotImageHeight<<std::endl;
@ -1245,6 +1246,8 @@ void JKQTPlotter::delayedResizeEvent()
if (plotImageWidth != image.width() || plotImageHeight != image.height()) {
QImage newImage(QSize(plotImageWidth, plotImageHeight), QImage::Format_ARGB32);
newImage.setDevicePixelRatio(dpr);
image=newImage;
sizeChanged=true;
}