<?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[Whether Qt Can Render Its Interface To A Vector Image Format]]></title><description><![CDATA[<p dir="auto">Occasionally, I want to screenshot my applications in a way that is scalable. Because <a href="https://discuss.kde.org/t/vectoral-screenshots/47413/2?u=rokejulianlockhart" target="_blank" rel="noopener noreferrer nofollow ugc">current compositors appear to exclusively render pixmaps</a>, this isn't possible at that level. Consequently, I am hoping that Qt may be able to, because modern Q{Quick}Styles appear to be comprised of non-bitmap components.</p>
<p dir="auto">To summarise, can I implement a button in a standard QWidget QApplication, which captures the current interface as a static vectoral image (of which SVG is probably all that I care about)?</p>
]]></description><link>https://forum.qt.io/topic/164736/whether-qt-can-render-its-interface-to-a-vector-image-format</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 06:09:15 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164736.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 01 Jun 2026 12:00:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Whether Qt Can Render Its Interface To A Vector Image Format on Tue, 02 Jun 2026 07:45:59 GMT]]></title><description><![CDATA[<p dir="auto">What about <code>QWidget::render()</code> with a <code> QSvgGenerator</code> ?</p>
]]></description><link>https://forum.qt.io/post/838519</link><guid isPermaLink="true">https://forum.qt.io/post/838519</guid><dc:creator><![CDATA[GrecKo]]></dc:creator><pubDate>Tue, 02 Jun 2026 07:45:59 GMT</pubDate></item><item><title><![CDATA[Reply to Whether Qt Can Render Its Interface To A Vector Image Format on Tue, 02 Jun 2026 11:10:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chris-kawa">@<bdi>Chris-Kawa</bdi></a>, using <code>lookandfeeltool -a org.kde.breeze.desktop</code>, that isn't a problem:</p>
<ol>
<li>
<pre><code class="language-py">#!/usr/bin/env python3

import sys

from PySide6.QtCore import Qt, QRect
from PySide6.QtGui import QAction
from PySide6.QtSvg import QSvgGenerator
from PySide6.QtWidgets import (
    QApplication,
    QCheckBox,
    QComboBox,
    QFormLayout,
    QGroupBox,
    QLabel,
    QLineEdit,
    QMainWindow,
    QPushButton,
    QSpinBox,
    QVBoxLayout,
    QWidget,
)


class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("SVG Export Example")

        central = QWidget()
        self.setCentralWidget(central)

        layout = QVBoxLayout(central)

        group = QGroupBox("Settings")
        layout.addWidget(group)

        form = QFormLayout(group)

        self.name = QLineEdit("Roke")
        self.number = QSpinBox()
        self.number.setValue(42)

        self.combo = QComboBox()
        self.combo.addItems(["Alpha", "Beta", "Gamma"])

        self.check = QCheckBox("Enable feature")
        self.check.setChecked(True)

        form.addRow("Name:", self.name)
        form.addRow("Number:", self.number)
        form.addRow("Mode:", self.combo)
        form.addRow("", self.check)

        self.label = QLabel(
            "This interface is rendered directly into SVG."
        )
        self.label.setWordWrap(True)

        layout.addWidget(self.label)

        self.export_button = QPushButton("Export SVG")
        self.export_button.clicked.connect(self.export_svg)
        layout.addWidget(self.export_button)

        export_action = QAction("Export SVG", self)
        export_action.triggered.connect(self.export_svg)
        self.menuBar().addAction(export_action)

    def export_svg(self):
        svg = QSvgGenerator()

        svg.setFileName("ui.svg")
        svg.setTitle("Qt Widget Export")
        svg.setDescription("Exported using QWidget.render()")

        size = self.size()
        svg.setSize(size)
        svg.setViewBox(QRect(0, 0, size.width(), size.height()))

        self.render(svg)

        print("Exported to ui.svg")


app = QApplication(sys.argv)

window = MainWindow()
window.resize(500, 300)
window.show()

sys.exit(app.exec())
</code></pre>
</li>
<li>
<pre><code class="language-SVG">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;svg width="176.39mm" height="105.83mm" baseProfile="tiny" version="1.2" viewBox="0 0 500 300" xmlns="http://www.w3.org/2000/svg"&gt;
	&lt;title&gt;Qt Widget Export&lt;/title&gt;
	&lt;desc&gt;Exported using QWidget.render()&lt;/desc&gt;
	&lt;g fill-rule="evenodd" font-family="Monospace" font-size="10" font-weight="400" stroke-linecap="square" stroke-linejoin="bevel"&gt;
		&lt;g fill="#eff0f1"&gt;
			&lt;rect width="500" height="300"/&gt;
		&lt;/g&gt;
		&lt;g fill="#dee0e2" stroke="#000" stroke-linecap="square" stroke-linejoin="bevel" stroke-opacity="0"&gt;
			&lt;rect width="500" height="31"/&gt;
		&lt;/g&gt;
		&lt;g fill="#dee0e2" stroke="#b9bbbd" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;polyline points="0 30 499 30" fill="none"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(6 36)" fill="#f4f5f5" stroke="#c6c8c9" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;path d="m0.5005 5.0005c0-2.4853 2.0147-4.5 4.5-4.5h478c2.485 0 4.5 2.0147 4.5 4.5v168c0 2.485-2.015 4.5-4.5 4.5h-478c-2.4853 0-4.5-2.015-4.5-4.5v-168z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(6 36)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text x="212.313" y="20.0469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Settings&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(30 70)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text y="20.5469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Name:&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 70)" fill="#fff"&gt;
			&lt;rect x="6" y="6" width="399" height="20"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 70)" fill="#fff" stroke="#c6c8c9" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;path d="m0.5005 5.0005c0-2.4853 2.0147-4.5 4.5-4.5h401c2.485 0 4.5 2.0147 4.5 4.5v21.999c0 2.4853-2.015 4.5-4.5 4.5h-401c-2.4853 0-4.5-2.0147-4.5-4.5v-21.999z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 70)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text x="8" y="20.8906" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Roke&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(14 108)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text y="20.5469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Number:&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 108)" fill="#fff" stroke="#c6c8c9" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;path d="m0.5005 5.0005c0-2.4853 2.0147-4.5 4.5-4.5h46.999c2.4853 0 4.5 2.0147 4.5 4.5v21.999c0 2.4853-2.0147 4.5-4.5 4.5h-46.999c-2.4853 0-4.5-2.0147-4.5-4.5v-21.999z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 108)" fill="none" stroke="#444749" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="2" stroke-width="1.001"&gt;
			&lt;polyline points="40.5 12.5 45 8 49.5 12.5" fill="none"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 108)" fill="none" stroke="#444749" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="2" stroke-width="1.001"&gt;
			&lt;polyline points="40.5 19.5 45 24 49.5 19.5" fill="none"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(81 114)" fill="#fff"&gt;
			&lt;rect width="31" height="20"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(81 114)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text x="2" y="14.8906" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;42&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(30 146)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text y="20.5469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Mode:&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 146)" fill="none" stroke="#000" stroke-linecap="square" stroke-linejoin="bevel" stroke-opacity=".125" stroke-width="1.001"&gt;
			&lt;path d="m1.5015 6.001c0-2.485 2.0145-4.4995 4.4995-4.4995h64.998c2.485 0 4.4995 2.0145 4.4995 4.4995v20.999c0 2.485-2.0145 4.4995-4.4995 4.4995h-64.998c-2.485 0-4.4995-2.0145-4.4995-4.4995v-20.999z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 146)" fill="#fcfcfc" stroke="#d1d1d2" stroke-linecap="square" stroke-linejoin="bevel" stroke-width="1.001"&gt;
			&lt;path d="m1.5015 6.0015c0-2.4853 2.0147-4.5 4.5-4.5h64.997c2.4853 0 4.5 2.0147 4.5 4.5v19.997c0 2.4853-2.0147 4.5-4.5 4.5h-64.997c-2.4853 0-4.5-2.0147-4.5-4.5v-19.997z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 146)" fill="none" stroke="#444649" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="2" stroke-width="1.001"&gt;
			&lt;polyline points="60.5 14.5 65 19 69.5 14.5" fill="none"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 146)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text x="7" y="21.0469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Alpha&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 184)" fill="#fcfcfc" stroke="#a6a6a6" stroke-linecap="square" stroke-linejoin="bevel" stroke-width="1.001"&gt;
			&lt;path d="m2.5005 7.5005c0-2.2091 1.7909-4 4-4h6.999c2.2091 0 4 1.7909 4 4v6.999c0 2.2091-1.7909 4-4 4h-6.999c-2.2091 0-4-1.7909-4-4v-6.999z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 184)" fill="#a6a6a6" fill-opacity=".33001" stroke="#a6a6a6" stroke-linecap="square" stroke-linejoin="bevel" stroke-width="1.001"&gt;
			&lt;path d="m2.5005 7.5005c0-2.2091 1.7909-4 4-4h6.999c2.2091 0 4 1.7909 4 4v6.999c0 2.2091-1.7909 4-4 4h-6.999c-2.2091 0-4-1.7909-4-4v-6.999z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 184)" fill-opacity="0" stroke="#232629" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="2" stroke-width="2.002"&gt;
			&lt;path d="m6 11 3 3 5.5-5.5" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(75 184)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text x="24" y="16.0469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Enable feature&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(6 220)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text y="22.0469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;This interface is rendered directly into SVG.&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(6 260)" fill="none" stroke="#000" stroke-linecap="square" stroke-linejoin="bevel" stroke-opacity=".125" stroke-width="1.001"&gt;
			&lt;path d="m1.5015 6.001c0-2.485 2.0145-4.4995 4.4995-4.4995h476c2.485 0 4.5 2.0145 4.5 4.4995v22.999c0 2.485-2.015 4.4995-4.5 4.4995h-476c-2.485 0-4.4995-2.0145-4.4995-4.4995v-22.999z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(6 260)" fill="#fcfcfc" stroke="#d1d1d2" stroke-linecap="square" stroke-linejoin="bevel" stroke-width="1.001"&gt;
			&lt;path d="m1.5015 6.0015c0-2.4853 2.0147-4.5 4.5-4.5h476c2.485 0 4.5 2.0147 4.5 4.5v21.997c0 2.4853-2.015 4.5-4.5 4.5h-476c-2.4853 0-4.5-2.0147-4.5-4.5v-21.997z" fill-rule="evenodd"/&gt;
		&lt;/g&gt;
		&lt;g transform="translate(6 260)" fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text x="205.016" y="22.0469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Export SVG&lt;/text&gt;
		&lt;/g&gt;
		&lt;g fill="none" stroke="#232629" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;text x="10.0156" y="20.0469" fill="#232629" font-family="Monospace" font-size="10" font-weight="400" stroke="none" xml:space="preserve"&gt;Export SVG&lt;/text&gt;
		&lt;/g&gt;
		&lt;g transform="translate(0 2)" fill="none" stroke="#808080" stroke-linecap="square" stroke-linejoin="bevel"&gt;
			&lt;polyline points="10 24 88 24" fill="none"/&gt;
		&lt;/g&gt;
	&lt;/g&gt;
&lt;/svg&gt;
</code></pre>
</li>
</ol>
<p dir="auto">Thanks, <a class="plugin-mentions-user plugin-mentions-a" href="/user/grecko">@<bdi>GrecKo</bdi></a>! Now, I need to ascertain how feasible this is to attach to other applications, after they've been compiled. Perhaps, I'll need a kind of DLL injection software.</p>
]]></description><link>https://forum.qt.io/post/838522</link><guid isPermaLink="true">https://forum.qt.io/post/838522</guid><dc:creator><![CDATA[RokeJulianLockhart]]></dc:creator><pubDate>Tue, 02 Jun 2026 11:10:28 GMT</pubDate></item><item><title><![CDATA[Reply to Whether Qt Can Render Its Interface To A Vector Image Format on Tue, 02 Jun 2026 08:25:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/grecko">@<bdi>GrecKo</bdi></a> Hm, well, I didn't think of that... Should work to an extent. The parts where the OS provided bitmaps are used will probably end up being just embedded binary image elements, so won't scale good and the resulting file could be very large, but some elements, like frames and text should be ok. Mostly depends on how the given style renders things - with painter shapes or with pixmaps. Good catch anyway.</p>
]]></description><link>https://forum.qt.io/post/838520</link><guid isPermaLink="true">https://forum.qt.io/post/838520</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Tue, 02 Jun 2026 08:25:53 GMT</pubDate></item><item><title><![CDATA[Reply to Whether Qt Can Render Its Interface To A Vector Image Format on Tue, 02 Jun 2026 07:45:59 GMT]]></title><description><![CDATA[<p dir="auto">What about <code>QWidget::render()</code> with a <code> QSvgGenerator</code> ?</p>
]]></description><link>https://forum.qt.io/post/838519</link><guid isPermaLink="true">https://forum.qt.io/post/838519</guid><dc:creator><![CDATA[GrecKo]]></dc:creator><pubDate>Tue, 02 Jun 2026 07:45:59 GMT</pubDate></item><item><title><![CDATA[Reply to Whether Qt Can Render Its Interface To A Vector Image Format on Mon, 01 Jun 2026 23:01:09 GMT]]></title><description><![CDATA[<p dir="auto">Appears that it would require a modification to Qt (and a conformant style), then. Thanks.</p>
]]></description><link>https://forum.qt.io/post/838511</link><guid isPermaLink="true">https://forum.qt.io/post/838511</guid><dc:creator><![CDATA[RokeJulianLockhart]]></dc:creator><pubDate>Mon, 01 Jun 2026 23:01:09 GMT</pubDate></item><item><title><![CDATA[Reply to Whether Qt Can Render Its Interface To A Vector Image Format on Mon, 01 Jun 2026 14:26:42 GMT]]></title><description><![CDATA[<p dir="auto">QStyle API is QPainter based, see <a href="https://doc.qt.io/qt-6/qstyle.html#drawPrimitive" target="_blank" rel="noopener noreferrer nofollow ugc">QStyle::drawPrimitive</a> for example.<br />
Internally the style can be whatever it needs, raster or vector based, but it's not exposed above that style API surface. A pixmap and a painter go into a black box and a rasterized UI element comes out.</p>
<p dir="auto">To add to that platform style plugins often use internally OS provided APIs for rendering UI elements, which is also usually bitmap based.<br />
You could write a vector based style, but there would still be no Qt API exposing its internals, so no way to get it back like that.</p>
<p dir="auto">Consequently there's no vector representation retained anywhere, so it can't be rendered out as such. The way scaling works is that Qt just renders the pixmaps with the scaling factor applied, so if you change scaling factor the element is re-painted bigger/smaller and cached for future use.</p>
]]></description><link>https://forum.qt.io/post/838501</link><guid isPermaLink="true">https://forum.qt.io/post/838501</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Mon, 01 Jun 2026 14:26:42 GMT</pubDate></item><item><title><![CDATA[Reply to Whether Qt Can Render Its Interface To A Vector Image Format on Mon, 01 Jun 2026 13:42:32 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><code>QWidget::grab()</code> produces <code>QPixmap</code>.</p>
</blockquote>
<p dir="auto"><a href="https://discourse.slicer.org/t/need-help-for-a-script-of-saving-screenshot-for-many-times/32877/3" target="_blank" rel="noopener noreferrer nofollow ugc"><code>discourse.slicer.org/t/32877/3</code></a> appears to demonstrate so. Perhaps, I'd need to see what APIs <em>it</em> calls.</p>
<blockquote>
<p dir="auto">I'd think that providing styles in vector formats has benefit of applying appropriate scale before rendering to raster to limit the artefacts.</p>
</blockquote>
<p dir="auto">Consequently, <a class="plugin-mentions-user plugin-mentions-a" href="/user/artwaw">@<bdi>artwaw</bdi></a>, was my assumption, that most styles are vectoral, incorrect? I'd assumed it solely because Fusion and Breeze appearing crisp with fractional scaling enabled, and when rendered on high-resolution displays, appeared to demonstrate so. Alternatively, do I misunderstand what you mean?</p>
]]></description><link>https://forum.qt.io/post/838500</link><guid isPermaLink="true">https://forum.qt.io/post/838500</guid><dc:creator><![CDATA[RokeJulianLockhart]]></dc:creator><pubDate>Mon, 01 Jun 2026 13:42:32 GMT</pubDate></item><item><title><![CDATA[Reply to Whether Qt Can Render Its Interface To A Vector Image Format on Mon, 01 Jun 2026 12:44:17 GMT]]></title><description><![CDATA[<p dir="auto">Hi!<br />
I do not think it is possible as - as far as I know and I am only happy to be corrected - Widgets are rendered on-screen as raster images. Hence QWidget::grab() produces QPixmap.</p>
<p dir="auto">I'd think that providing styles in vector formats has benefit of applying appropriate scale before rendering to raster to limit the artefacts.</p>
<p dir="auto">But perhaps someone with better knowledge has better answers for you?</p>
]]></description><link>https://forum.qt.io/post/838497</link><guid isPermaLink="true">https://forum.qt.io/post/838497</guid><dc:creator><![CDATA[artwaw]]></dc:creator><pubDate>Mon, 01 Jun 2026 12:44:17 GMT</pubDate></item></channel></rss>