high dpi: translateLine icon fixed.

This commit is contained in:
xiaoyifang 2022-01-25 23:38:14 +08:00
parent 9c5d7acc5a
commit 7738d35350
3 changed files with 53 additions and 28 deletions

View file

@ -92,8 +92,9 @@ void ExtLineEdit::updateMargins()
Side realLeft = (leftToRight ? Left : Right); Side realLeft = (leftToRight ? Left : Right);
Side realRight = (leftToRight ? Right : Left); Side realRight = (leftToRight ? Right : Left);
int leftMargin = iconButtons[realLeft]->pixmap().width() + 8; int widgetHeight=height();
int rightMargin = iconButtons[realRight]->pixmap().width() + 8; int leftMargin = widgetHeight + 8;
int rightMargin = widgetHeight + 8;
setTextMargins( setTextMargins(
(iconEnabled[realLeft] ? leftMargin : 0), 1, (iconEnabled[realLeft] ? leftMargin : 0), 1,
@ -162,7 +163,10 @@ void IconButton::paintEvent(QPaintEvent *)
{ {
QPainter painter(this); QPainter painter(this);
painter.setRenderHint(QPainter::RenderHint::Antialiasing); 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()); pixmapRect.moveCenter(rect().center());
if (m_autohide) if (m_autohide)

View file

@ -2,24 +2,43 @@
<!-- Created with Inkscape (http://www.inkscape.org/) --> <!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg <svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512" width="512"
height="512" height="512"
id="svg2" id="svg2"
version="1.1" version="1.1"
inkscape:version="0.48.4 r9939" inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="arrow_right.svg" sodipodi:docname="1downarrow.svg"
inkscape:export-filename="C:\Documents and Settings\bstawarz\Bureau\Projects\Projet Site\v1.0\arrow.png" inkscape:export-filename="C:\Documents and Settings\bstawarz\Bureau\Projects\Projet Site\v1.0\arrow.png"
inkscape:export-xdpi="90" inkscape:export-xdpi="90"
inkscape:export-ydpi="90"> 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/">
<defs <defs
id="defs4" /> id="defs4">
<linearGradient
id="linearGradient13128"
inkscape:swatch="solid">
<stop
style="stop-color:#222222;stop-opacity:0.49019608;"
offset="0"
id="stop13126" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient13128"
id="linearGradient13130"
x1="53.278525"
y1="796.3622"
x2="458.72148"
y2="796.3622"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview <sodipodi:namedview
id="base" id="base"
pagecolor="#ffffff" pagecolor="#ffffff"
@ -28,16 +47,17 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="0.49497475" inkscape:zoom="0.49497475"
inkscape:cx="271.28377" inkscape:cx="-126.26907"
inkscape:cy="123.11958" inkscape:cy="122.22846"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="false" showgrid="false"
inkscape:window-width="986" inkscape:window-width="1402"
inkscape:window-height="626" inkscape:window-height="1040"
inkscape:window-x="291" inkscape:window-x="26"
inkscape:window-y="239" inkscape:window-y="0"
inkscape:window-maximized="0" /> inkscape:window-maximized="0"
inkscape:pagecheckerboard="0" />
<metadata <metadata
id="metadata7"> id="metadata7">
<rdf:RDF> <rdf:RDF>
@ -46,18 +66,18 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title> <dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
<g <g
inkscape:label="Calque 1" inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1" id="layer1"
transform="translate(0,-540.3622)"> transform="translate(0,-540.3622)"
style="display:inline">
<path <path
style="fill:#222222;fill-opacity:1;stroke:#222222;stroke-width:38.88000107;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" style="display:inline;fill:url(#linearGradient13130);fill-opacity:1;stroke:#222222;stroke-width:0;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.5403226;opacity:1"
d="M 72.71772,732.21344 255.99937,915.49506 439.28228,732.21344 384.29689,677.22934 255.99937,805.52686 127.70315,677.22934 z" d="M 72.71772,732.21344 255.99937,915.49506 439.28228,732.21344 384.29689,677.22934 255.99937,805.52686 127.70315,677.22934 Z"
id="path3766-1" id="path3766-1"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" /> sodipodi:nodetypes="ccccccc" />

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -111,12 +111,13 @@ TranslateBox::TranslateBox(QWidget *parent) : QWidget(parent),
layout->addWidget(translate_line); layout->addWidget(translate_line);
QPixmap image(":/icons/system-search.svg"); 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->setButtonToolTip(ExtLineEdit::Left, tr("Options"));
translate_line->setButtonVisible(ExtLineEdit::Left, true); translate_line->setButtonVisible(ExtLineEdit::Left, true);
translate_line->setButtonFocusPolicy(ExtLineEdit::Left, Qt::ClickFocus); 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->setButtonPixmap(ExtLineEdit::Right, right);
translate_line->setButtonToolTip(ExtLineEdit::Right, tr("Drop-down")); translate_line->setButtonToolTip(ExtLineEdit::Right, tr("Drop-down"));
translate_line->setButtonVisible(ExtLineEdit::Right, true); translate_line->setButtonVisible(ExtLineEdit::Right, true);