<?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[C++ widget in PySide6 application]]></title><description><![CDATA[<p dir="auto">It looks like my PySide6 application is somewhat slow in drawing so I am considering moving my problematic Qt widget to the C++ python extension.</p>
<p dir="auto">It should definitely be possible because entire C++ Qt is available for Python :)</p>
<p dir="auto">But is this supported or recommended for custom widgets?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/139214/c-widget-in-pyside6-application</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 13:50:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139214.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 10 Sep 2022 12:41:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ widget in PySide6 application on Mon, 12 Sep 2022 14:05:36 GMT]]></title><description><![CDATA[<p dir="auto">Are you using OpenGL or QPainter-based drawing?</p>
<p dir="auto">For example, there is QPainter.drawPointsNp() which takes 2 numpy-arrays:</p>
<p dir="auto"><a href="https://doc.qt.io/qtforpython-6/PySide6/QtGui/QPainter.html#PySide6.QtGui.PySide6.QtGui.QPainter.drawPointsNp" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qtforpython-6/PySide6/QtGui/QPainter.html#PySide6.QtGui.PySide6.QtGui.QPainter.drawPointsNp</a></p>
<p dir="auto">For OpenGL, the QOpenGLFunctions typically also take numpy arrays.</p>
<p dir="auto">Nevertheless, creating Python bindings for a Custom widget is also possible with shiboken. It just takes some thought on how to structure  it. You might want a C++ library containing the widget, a separate Qt Designer plugin and the bindings.</p>
<p dir="auto">For generating bindings. see for example<br />
<a href="https://doc.qt.io/qtforpython-6/examples/example_scriptableapplication__scriptableapplication.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qtforpython-6/examples/example_scriptableapplication__scriptableapplication.html</a></p>
]]></description><link>https://forum.qt.io/post/728387</link><guid isPermaLink="true">https://forum.qt.io/post/728387</guid><dc:creator><![CDATA[friedemannkleint]]></dc:creator><pubDate>Mon, 12 Sep 2022 14:05:36 GMT</pubDate></item><item><title><![CDATA[Reply to C++ widget in PySide6 application on Tue, 27 Sep 2022 14:04:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dmytro-16384">@<bdi>dmytro-16384</bdi></a> PySide 6.4 will have numpy support built-in.</p>
]]></description><link>https://forum.qt.io/post/730353</link><guid isPermaLink="true">https://forum.qt.io/post/730353</guid><dc:creator><![CDATA[friedemannkleint]]></dc:creator><pubDate>Tue, 27 Sep 2022 14:04:52 GMT</pubDate></item><item><title><![CDATA[Reply to C++ widget in PySide6 application on Mon, 12 Sep 2022 18:47:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/friedemannkleint">@<bdi>friedemannkleint</bdi></a> said in <a href="/post/728387">C++ widget in PySide6 application</a>:</p>
<blockquote>
<p dir="auto">QPainter.drawPointsNp</p>
</blockquote>
<p dir="auto">Thank you for your hints. The QPainter.drawPointsNp looked promising, but I need lines :) I even constructed a hack using QXYSeries which also accepts Numpy arrays and can return QPoints, but unfortunately prebuilt PySide6 comes without any Numpy support (why???). Rebuilding PySide and support custom version looks like an overkill for me for now.</p>
<p dir="auto">I'm really appreciate your help, thank you for the links I will give them a try.</p>
]]></description><link>https://forum.qt.io/post/728434</link><guid isPermaLink="true">https://forum.qt.io/post/728434</guid><dc:creator><![CDATA[dmytro-16384]]></dc:creator><pubDate>Mon, 12 Sep 2022 18:47:11 GMT</pubDate></item><item><title><![CDATA[Reply to C++ widget in PySide6 application on Mon, 12 Sep 2022 14:05:36 GMT]]></title><description><![CDATA[<p dir="auto">Are you using OpenGL or QPainter-based drawing?</p>
<p dir="auto">For example, there is QPainter.drawPointsNp() which takes 2 numpy-arrays:</p>
<p dir="auto"><a href="https://doc.qt.io/qtforpython-6/PySide6/QtGui/QPainter.html#PySide6.QtGui.PySide6.QtGui.QPainter.drawPointsNp" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qtforpython-6/PySide6/QtGui/QPainter.html#PySide6.QtGui.PySide6.QtGui.QPainter.drawPointsNp</a></p>
<p dir="auto">For OpenGL, the QOpenGLFunctions typically also take numpy arrays.</p>
<p dir="auto">Nevertheless, creating Python bindings for a Custom widget is also possible with shiboken. It just takes some thought on how to structure  it. You might want a C++ library containing the widget, a separate Qt Designer plugin and the bindings.</p>
<p dir="auto">For generating bindings. see for example<br />
<a href="https://doc.qt.io/qtforpython-6/examples/example_scriptableapplication__scriptableapplication.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qtforpython-6/examples/example_scriptableapplication__scriptableapplication.html</a></p>
]]></description><link>https://forum.qt.io/post/728387</link><guid isPermaLink="true">https://forum.qt.io/post/728387</guid><dc:creator><![CDATA[friedemannkleint]]></dc:creator><pubDate>Mon, 12 Sep 2022 14:05:36 GMT</pubDate></item><item><title><![CDATA[Reply to C++ widget in PySide6 application on Sat, 10 Sep 2022 14:13:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/728145">C++ widget in PySide6 application</a>:</p>
<blockquote>
<p dir="auto">PySide/PyQt are only wrappers around Qt code for Python.  Are you sure your "slowness" is in the Python code rather than the time it takes to do whatever Qt drawing or even your algorithm?</p>
</blockquote>
<p dir="auto">I think slowness is in my python draw code. I'm drawing a lot (1000s) of small lines and preparing QPoints lists seems takes some time in Python. I tried obvious optimisations like re-using point objects and had some improvements but anyway it takes up to 100ms to update a frame.</p>
<p dir="auto">Drawing itself should be quite cheap if I understand correctly, it should directly be mapped to the Open GL draw call.</p>
<p dir="auto">So the next thing I want to try is moving this code to C++ if possible.</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/post/728149</link><guid isPermaLink="true">https://forum.qt.io/post/728149</guid><dc:creator><![CDATA[dmytro-16384]]></dc:creator><pubDate>Sat, 10 Sep 2022 14:13:21 GMT</pubDate></item><item><title><![CDATA[Reply to C++ widget in PySide6 application on Sat, 10 Sep 2022 13:10:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dmytro-16384">@<bdi>dmytro-16384</bdi></a><br />
Hello and welcome.</p>
<p dir="auto">PySide/PyQt are only wrappers around Qt code for Python.  Are you sure your "slowness" is in the Python code rather than the time it takes to do whatever Qt drawing or even your algorithm?</p>
]]></description><link>https://forum.qt.io/post/728145</link><guid isPermaLink="true">https://forum.qt.io/post/728145</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Sat, 10 Sep 2022 13:10:19 GMT</pubDate></item></channel></rss>