<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[SVG rendering differently on Linux vs windows.]]></title><description><![CDATA[<p dir="auto">Hi All,</p>
<p dir="auto">Qt 6.5.3,<br />
win10/win11 vs<br />
Ubuntu 24.04.1 xcfe or wayland  platform plugin, both exhibit same behavior.</p>
<p dir="auto">Recently I've ported a number of icons from PNG to SVG, and the new SVG icons are displaying in a smaller size on Linux relative to windows.<br />
I'm using the inbuilt iconengine functionality to load an SVG as a resource from an stylesheet.<br />
Specifically the images are used as the "has siblings open / closed" images within a QTreeView.</p>
<p dir="auto">My Stylesheet is</p>
<pre><code>    QTreeView::branch:has-children:!has-siblings:closed,
    QTreeView::branch:closed:has-children:has-siblings { border-image: none; image: url(:/BrowserWidget/ClosedArrow.svg); }
    QTreeView::branch:open:has-children:!has-siblings,
    QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(:/BrowserWidget/OpenArrow.svg); }
</code></pre>
<p dir="auto">On windows this looks like:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/e4fa9797-1400-49ae-826a-93252a18cfee.png" alt="3c99702d-7369-4ae9-8d43-2f004422c835-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">however on Linux it looks like:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/55f8293f-01f0-4ad4-9267-eab121ac511e.png" alt="1317af4e-ca84-497a-acde-738069fa46ed-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Notice that the arrow is significantly smaller on the Linux version.<br />
They are both using identical SVG images, stylesheet, and drawing code.</p>
<p dir="auto">Has anyone seen anything like this before?<br />
I'd really like to avoid using different SVG images on each platform</p>
<p dir="auto">the source for the SVG itself is very simple,</p>
<pre><code>&lt;svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"&gt;
&lt;path d="M8 5.00009L2 8.66009V1.34009L8 5.00009Z" fill="#CCCCCC"/&gt;
&lt;/svg&gt;
</code></pre>
<p dir="auto">If I had to guess, I would say that the Linux version is showing the SVG at 1:1, but the windows version is doing some additional scaling to  increase the visible size of the image used. Because the view box is 10x10, but the actual image drawn is less than that, and the window's screen shot shows the arrow as occupying close to a 10x10 box, But the linux arrow is much smaller.</p>
<p dir="auto">Because I am using the stylesheet and iconengine to handle the SVG loading, and not explicitly reading it with QtSvg,<br />
I dont have much control over how the image is handled.<br />
I've tried adding a height and width argument to the  stylesheet, but that doesn't seem to have any effect?<br />
Perhaps this is the issue/Bug?<br />
I dont have a good understanding of what the width and height values do in the case of an SVG resource.</p>
<p dir="auto">I'd love some help and or explanation of what is going on?</p>
<ul>
<li>James</li>
</ul>
]]></description><link>https://forum.qt.io/topic/164784/svg-rendering-differently-on-linux-vs-windows.</link><generator>RSS for Node</generator><lastBuildDate>Tue, 23 Jun 2026 02:33:36 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164784.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 12 Jun 2026 01:06:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Thu, 18 Jun 2026 00:02:46 GMT]]></title><description><![CDATA[<p dir="auto">I've tested the same code against Qt 6.9.3 and it doesn't seem to be an issue there.</p>
]]></description><link>https://forum.qt.io/post/838803</link><guid isPermaLink="true">https://forum.qt.io/post/838803</guid><dc:creator><![CDATA[Jammin44fm]]></dc:creator><pubDate>Thu, 18 Jun 2026 00:02:46 GMT</pubDate></item><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Wed, 17 Jun 2026 00:47:41 GMT]]></title><description><![CDATA[<p dir="auto">Ahh thanks for the additional info, and for the Bug link.<br />
That would seem to explain the behavior I am seeing - on Linux anyway.</p>
<p dir="auto">It seems that the only solution for the moment is to modify the SVG themselves :(</p>
]]></description><link>https://forum.qt.io/post/838786</link><guid isPermaLink="true">https://forum.qt.io/post/838786</guid><dc:creator><![CDATA[Jammin44fm]]></dc:creator><pubDate>Wed, 17 Jun 2026 00:47:41 GMT</pubDate></item><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Tue, 16 Jun 2026 19:08:49 GMT]]></title><description><![CDATA[<p dir="auto">The <code>width</code> and <code>height</code> properties is not supported for the <code>image</code> property. See also <a href="https://doc.qt.io/qt-6/stylesheet-reference.html#image" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/stylesheet-reference.html#image</a> why a png is rendered with a different sice than a svg.</p>
<p dir="auto">I've filled a bug report about this and also created an initial patch<br />
<a href="https://qt-project.atlassian.net/browse/QTBUG-147536" target="_blank" rel="noopener noreferrer nofollow ugc">https://qt-project.atlassian.net/browse/QTBUG-147536</a></p>
]]></description><link>https://forum.qt.io/post/838784</link><guid isPermaLink="true">https://forum.qt.io/post/838784</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 16 Jun 2026 19:08:49 GMT</pubDate></item><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Tue, 16 Jun 2026 06:45:04 GMT]]></title><description><![CDATA[<p dir="auto">I know very little about SVG syntax. However, what I see is that there is a fill color set. Usually, shapes also have an outline/border/stroke. Maybe you can specify the stroke width as well (maybe as 0?). There might be different defaults on Windows and Linux about the outline. It's just a wild guess.</p>
]]></description><link>https://forum.qt.io/post/838773</link><guid isPermaLink="true">https://forum.qt.io/post/838773</guid><dc:creator><![CDATA[SimonSchroeder]]></dc:creator><pubDate>Tue, 16 Jun 2026 06:45:04 GMT</pubDate></item><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Mon, 15 Jun 2026 22:33:21 GMT]]></title><description><![CDATA[<p dir="auto">There are the PNG's...<br />
<img src="https://ddgobkiprc33d.cloudfront.net/374e0793-e938-4a60-8189-8d5570cebc7d.png" alt="ClosedArrow.png" class=" img-fluid img-markdown" /> <img src="https://ddgobkiprc33d.cloudfront.net/4c6aa778-97d6-49d8-9c34-08b3b45a3f9f.png" alt="OpenArrow.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Hmm it wont let me attach the SVG's</p>
<p dir="auto">But I'll paste the svg.<br />
Closed Arrow</p>
<pre><code class="language-&lt;svg">&lt;path d="M8 5.00009L2 8.66009V1.34009L8 5.00009Z" fill="#CCCCCC"/&gt;
&lt;/svg&gt;

Open Arrow
&lt;svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"&gt;
&lt;path d="M8.65997 2L4.99997 8L1.33997 2H8.65997Z" fill="#CCCCCC"/&gt;
&lt;/svg&gt;
</code></pre>
<p dir="auto">Looking at the images side by side I can see they are slightly different,<br />
But in a way that is the opposite of how they are displayed ion the sample app!!</p>
<p dir="auto">The png versions have the triangle touching the sides of the image,<br />
However in the SVG's the triangles has some empty space around the triangle.<br />
But in the sample the png version the arrows looks smaller, and the svg looks bigger?</p>
]]></description><link>https://forum.qt.io/post/838767</link><guid isPermaLink="true">https://forum.qt.io/post/838767</guid><dc:creator><![CDATA[Jammin44fm]]></dc:creator><pubDate>Mon, 15 Jun 2026 22:33:21 GMT</pubDate></item><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Mon, 15 Jun 2026 18:47:13 GMT]]></title><description><![CDATA[<p dir="auto">Do you also have somewhere a set of images to test ?</p>
]]></description><link>https://forum.qt.io/post/838765</link><guid isPermaLink="true">https://forum.qt.io/post/838765</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 15 Jun 2026 18:47:13 GMT</pubDate></item><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Mon, 15 Jun 2026 00:53:06 GMT]]></title><description><![CDATA[<p dir="auto">I've created a very simple TreeView sample app that lets me modify the stylesheet directly within the code,<br />
but nothing i do seems to effect the size of the Arrow icons attached to the sibling with children items in the Treeview.</p>
<p dir="auto">the code...</p>
<pre><code>#include &lt;QApplication&gt;
#include &lt;QScreen&gt;
#include &lt;QTreeView&gt;
#include &lt;QStandardItemModel&gt;
#include &lt;QHeaderView&gt;


int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    // 1. Create the Tree View and populate data
    QTreeView treeView;
    QStandardItemModel model(4, 2);
    model.setHeaderData(0, Qt::Horizontal, "Task Name");
    model.setHeaderData(1, Qt::Horizontal, "Status");

    // Fill dummy hierarchical data
    for (int i = 0; i &lt; 3; ++i) {
        QStandardItem *parentItem = new QStandardItem(QString("Project Phase %1").arg(i + 1));
        QStandardItem *statusItem = new QStandardItem("In Progress");
        model.setItem(i, 0, parentItem);
        model.setItem(i, 1, statusItem);

        for (int j = 0; j &lt; 2; ++j) {
            QStandardItem *childItem = new QStandardItem(QString("Sub-task %1.%2").arg(i + 1).arg(j + 1));
            QStandardItem *childStatus = new QStandardItem("Pending");
            parentItem-&gt;appendRow(QList&lt;QStandardItem*&gt;() &lt;&lt; childItem &lt;&lt; childStatus);
        }
    }

    treeView.setModel(&amp;model);
    treeView.expandAll();

    // Enable alternating backgrounds required by the stylesheet
    treeView.setAlternatingRowColors(true);

    // 2. Define and Apply the QSS Stylesheet
    QString treeStylesheet = R"(
        /* Main view styling */
     QTreeView { background: #4d4d4d; selection-color: black; selection-background-color: #f9d20e; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; show-decoration-selected: 1; }
     QTreeView::item { height: 25px; padding-left: 7px; background-color: transparent; }
     QTreeView::branch:has-siblings:!adjoins-item { border: none; }
     QTreeView::branch:has-siblings:adjoins-item { border: none; }
     QTreeView::branch:!has-children:!has-siblings:adjoins-item { border: none; }
     QTreeView::branch:has-children:!has-siblings:closed,
     QTreeView::branch:closed:has-children:has-siblings { border-image: none; image: url(:/ClosedArrow.svg);      width: 5px; height: 5px; }
     QTreeView::branch:open:has-children:!has-siblings,
     QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(:/OpenArrow.svg);      width: 5px; height: 5px; }
     QTreeView QLineEdit { color: #000000; background: #ffffff }
     QTreeView QScrollBar:vertical { padding-left: 3px; background: black; width: 11px; margin: 0px; }


    )";

    treeView.setStyleSheet(treeStylesheet);
    treeView.resize(450, 300);
    treeView.show();

    return app.exec();
}
</code></pre>
<p dir="auto">I've been swapping out the PNG's and SVG's - each result in a different size of the triangle that get rendered, but neither SVG or PNG are effected by the icon-size or, width and height properties?</p>
<p dir="auto">How am I supposed to get matched sizes?<br />
The SVG file is near exact copy of the PNG image, why am i getting such different results?<br />
and what is the correct way to control the icon size for this specific icon / image?</p>
<p dir="auto">Regards,</p>
]]></description><link>https://forum.qt.io/post/838747</link><guid isPermaLink="true">https://forum.qt.io/post/838747</guid><dc:creator><![CDATA[Jammin44fm]]></dc:creator><pubDate>Mon, 15 Jun 2026 00:53:06 GMT</pubDate></item><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Mon, 15 Jun 2026 00:15:08 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the suggestion, but using the  <code>icon-size</code> in my stylesheet doesn't have any effect.<br />
I'm working on reproducing the issue in simpler Qt only sample.<br />
Perhaps there is some other aspect of our styling that is causing the problem.<br />
But strange that things are OK on Mac and Windows, but I have this specific issue on Linux.</p>
]]></description><link>https://forum.qt.io/post/838746</link><guid isPermaLink="true">https://forum.qt.io/post/838746</guid><dc:creator><![CDATA[Jammin44fm]]></dc:creator><pubDate>Mon, 15 Jun 2026 00:15:08 GMT</pubDate></item><item><title><![CDATA[Reply to SVG rendering differently on Linux vs windows. on Fri, 12 Jun 2026 18:53:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Out of curiosity, what happens if your set the <code>icon-size</code> in your stylesheet ?</p>
]]></description><link>https://forum.qt.io/post/838714</link><guid isPermaLink="true">https://forum.qt.io/post/838714</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 12 Jun 2026 18:53:56 GMT</pubDate></item></channel></rss>