`

QPainter在4K屏上绘制不清楚 (QPainter not clear in high DPI)

    博客分类:
  • Qt
阅读更多

如果是先将内容绘制到一个图片缓存上的话,这个图片缓存需要放大到设备坐标系了,而不是简单的逻辑坐标系大小。参考来源: https://stackoverflow.com/questions/42011410/qt-drawing-high-dpi-qpixmaps。

具体做法如下:

假如代码是这么写的: m_pBufferImg = new QPixmap(this->width(),this->height());QPainter p(*m_pBufferImg);...

则需要改为: qreal dpr = this->devicePixelRatioF();m_pBufferImg = new QPixmap(this->width()*dpr,this->height()*dpr); m_pBufferImg r->setDevicePixelRatio(dpr); QPainter p(*m_pBufferImg);...

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics