Skip to content

Commit

Permalink
Fix hidpi support for UnsupportedScreenGrabber fallback image
Browse files Browse the repository at this point in the history
Without this, the text rendering will be blurry on hidpi setups.
  • Loading branch information
milianw committed Jan 3, 2025
1 parent d847ddb commit 73ca923
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/quickinspector/quickscreengrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,15 +822,16 @@ UnsupportedScreenGrabber::~UnsupportedScreenGrabber()
void UnsupportedScreenGrabber::requestGrabWindow(const QRectF & /*userViewport*/)
{
m_grabbedFrame.image = m_window->grabWindow();
m_grabbedFrame.image.setDevicePixelRatio(m_window->effectiveDevicePixelRatio());

int alpha = 120;
if (m_grabbedFrame.image.isNull()) {
m_grabbedFrame.image = QImage(m_window->size(), QImage::Format_ARGB32);
m_grabbedFrame.image = QImage(m_window->size() * m_window->effectiveDevicePixelRatio(), QImage::Format_ARGB32);
m_grabbedFrame.image.fill(Qt::black);
alpha = 200;
}

m_grabbedFrame.image.setDevicePixelRatio(m_window->effectiveDevicePixelRatio());

QPainter p(&m_grabbedFrame.image);
p.setRenderHint(QPainter::TextAntialiasing);
QColor gray(Qt::black);
Expand Down

0 comments on commit 73ca923

Please sign in to comment.