From 3aa76886d0e9d8144abf1a80d7339d6861950cfb Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sun, 23 Jan 2022 11:36:58 +0800 Subject: [PATCH] high api: draw image with antialiasing --- bgl.cc | 1 + dictionary.cc | 2 +- extlineedit.cc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bgl.cc b/bgl.cc index 2a9a8f53..c62596c7 100644 --- a/bgl.cc +++ b/bgl.cc @@ -350,6 +350,7 @@ namespace result.fill( 0 ); // Black transparent QPainter painter( &result ); + painter.setRenderHint(QPainter::RenderHint::Antialiasing); painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2, img.height() == max ? 0 : ( max - img.height() ) / 2 ), diff --git a/dictionary.cc b/dictionary.cc index 53f61698..4a185564 100644 --- a/dictionary.cc +++ b/dictionary.cc @@ -257,7 +257,7 @@ bool Class::loadIconFromFile( QString const & _filename, bool isFullName ) result.fill( 0 ); // Black transparent QPainter painter( &result ); - + painter.setRenderHint(QPainter::RenderHint::Antialiasing); painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2, img.height() == max ? 0 : ( max - img.height() ) / 2 ), img ); diff --git a/extlineedit.cc b/extlineedit.cc index 1fb445fa..36bb783b 100644 --- a/extlineedit.cc +++ b/extlineedit.cc @@ -161,7 +161,7 @@ IconButton::IconButton(QWidget *parent) void IconButton::paintEvent(QPaintEvent *) { QPainter painter(this); - + painter.setRenderHint(QPainter::RenderHint::Antialiasing); QRect pixmapRect = QRect(0, 0, m_pixmap.width(), m_pixmap.height()); pixmapRect.moveCenter(rect().center());