mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2025-01-12 17:00:32 +08:00
Enable high-dpi support for plots.
This commit is contained in:
parent
fc7622e901
commit
6f487c2c24
@ -1236,8 +1236,9 @@ void JKQTPlotter::resizeEvent(QResizeEvent *event) {
|
|||||||
|
|
||||||
void JKQTPlotter::delayedResizeEvent()
|
void JKQTPlotter::delayedResizeEvent()
|
||||||
{
|
{
|
||||||
int plotImageWidth=width();
|
qreal dpr = devicePixelRatioF();
|
||||||
int plotImageHeight=height();
|
int plotImageWidth=width() * dpr;
|
||||||
|
int plotImageHeight=height() * dpr;
|
||||||
|
|
||||||
plotImageHeight=plotImageHeight-getPlotYOffset();
|
plotImageHeight=plotImageHeight-getPlotYOffset();
|
||||||
//qDebug()<<"resize: "<<plotImageWidth<<" x "<<plotImageHeight<<std::endl;
|
//qDebug()<<"resize: "<<plotImageWidth<<" x "<<plotImageHeight<<std::endl;
|
||||||
@ -1245,6 +1246,8 @@ void JKQTPlotter::delayedResizeEvent()
|
|||||||
if (plotImageWidth != image.width() || plotImageHeight != image.height()) {
|
if (plotImageWidth != image.width() || plotImageHeight != image.height()) {
|
||||||
|
|
||||||
QImage newImage(QSize(plotImageWidth, plotImageHeight), QImage::Format_ARGB32);
|
QImage newImage(QSize(plotImageWidth, plotImageHeight), QImage::Format_ARGB32);
|
||||||
|
newImage.setDevicePixelRatio(dpr);
|
||||||
|
|
||||||
image=newImage;
|
image=newImage;
|
||||||
sizeChanged=true;
|
sizeChanged=true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user