From 7738d3535007f5c2f309bbca2a361a5eb450a79b Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Tue, 25 Jan 2022 23:38:14 +0800 Subject: [PATCH] high dpi: translateLine icon fixed. --- extlineedit.cc | 10 +++++-- icons/1downarrow.svg | 66 +++++++++++++++++++++++++++++--------------- translatebox.cc | 5 ++-- 3 files changed, 53 insertions(+), 28 deletions(-) diff --git a/extlineedit.cc b/extlineedit.cc index 36bb783b..ecaa7bda 100644 --- a/extlineedit.cc +++ b/extlineedit.cc @@ -92,8 +92,9 @@ void ExtLineEdit::updateMargins() Side realLeft = (leftToRight ? Left : Right); Side realRight = (leftToRight ? Right : Left); - int leftMargin = iconButtons[realLeft]->pixmap().width() + 8; - int rightMargin = iconButtons[realRight]->pixmap().width() + 8; + int widgetHeight=height(); + int leftMargin = widgetHeight + 8; + int rightMargin = widgetHeight + 8; setTextMargins( (iconEnabled[realLeft] ? leftMargin : 0), 1, @@ -162,7 +163,10 @@ void IconButton::paintEvent(QPaintEvent *) { QPainter painter(this); painter.setRenderHint(QPainter::RenderHint::Antialiasing); - QRect pixmapRect = QRect(0, 0, m_pixmap.width(), m_pixmap.height()); + painter.setRenderHint(QPainter::RenderHint::TextAntialiasing); + painter.setRenderHint(QPainter::RenderHint::SmoothPixmapTransform); + painter.setRenderHint(QPainter::RenderHint::LosslessImageRendering); + QRect pixmapRect = QRect(0, 0, height(), height()); pixmapRect.moveCenter(rect().center()); if (m_autohide) diff --git a/icons/1downarrow.svg b/icons/1downarrow.svg index da84dac0..fcd98ffd 100644 --- a/icons/1downarrow.svg +++ b/icons/1downarrow.svg @@ -2,24 +2,43 @@ + inkscape:export-ydpi="90" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + id="defs4"> + + + + + + inkscape:window-width="1402" + inkscape:window-height="1040" + inkscape:window-x="26" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:pagecheckerboard="0" /> @@ -46,18 +66,18 @@ image/svg+xml - + + transform="translate(0,-540.3622)" + style="display:inline"> diff --git a/translatebox.cc b/translatebox.cc index 83b1fc82..67944754 100644 --- a/translatebox.cc +++ b/translatebox.cc @@ -111,12 +111,13 @@ TranslateBox::TranslateBox(QWidget *parent) : QWidget(parent), layout->addWidget(translate_line); QPixmap image(":/icons/system-search.svg"); - translate_line->setButtonPixmap(ExtLineEdit::Left, image.scaled(18, 18, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + + translate_line->setButtonPixmap(ExtLineEdit::Left, image); // translate_line->setButtonToolTip(ExtLineEdit::Left, tr("Options")); translate_line->setButtonVisible(ExtLineEdit::Left, true); translate_line->setButtonFocusPolicy(ExtLineEdit::Left, Qt::ClickFocus); - QPixmap right(":/icons/1downarrow.png"); + QPixmap right(":/icons/1downarrow.svg"); translate_line->setButtonPixmap(ExtLineEdit::Right, right); translate_line->setButtonToolTip(ExtLineEdit::Right, tr("Drop-down")); translate_line->setButtonVisible(ExtLineEdit::Right, true);