<?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[Can&#x27;t store a QPointer into a QVariant]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I'm trying to store a Pointer to a QVector&lt;Album*&gt; into a QAction, but I can't convert it to QVariant.</p>
<p dir="auto">I have<br />
@<br />
QVector&lt;Album*&gt;* data;<br />
action-&gt;setData(QVariant::fromValue(QPointer&lt;QVector&lt;Album*&gt; &gt;(data)));<br />
@</p>
<p dir="auto">and it fails with following error:</p>
<p dir="auto">In instantiation of 'QPointer&lt;T&gt;::QPointer(T*) [with T = QVector<a target="_blank" rel="noopener noreferrer nofollow ugc">Digikam::Album*</a>]':<br />
/media/LinuxHDD/slavik/digikam-software-compilation/core/digikam/tags/tagmodificationhelper.cpp:98:72:   required from here<br />
/usr/include/qt4/QtCore/qpointer.h:59:32: error: cannot convert 'QVector<a target="_blank" rel="noopener noreferrer nofollow ugc">Digikam::Album*</a><em>' to 'QObject</em>' in initialization<br />
inline QPointer(T *p) : o(p)</p>
<p dir="auto">I don't know how to deal with this... QPointer&lt;QVector&gt; works fine , but QPointer&lt;QVector&lt;Album*&gt; &gt; won't...</p>
<p dir="auto">Thank you!</p>
]]></description><link>https://forum.qt.io/topic/29629/can-t-store-a-qpointer-into-a-qvariant</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 09:15:52 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/29629.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Jul 2013 11:56:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Can&#x27;t store a QPointer into a QVariant on Fri, 19 Jul 2013 20:44:46 GMT]]></title><description><![CDATA[<p dir="auto">I was able to pass it with:</p>
<p dir="auto">Q_DECLARE_METACALL(QList&lt;Album*&gt;)</p>
<p dir="auto">Basically, I try to implement item deletion in a context menu. Originally, tree was single selection and a pointer to item was encoded into QAction's data. Now, I'm trying to implement multiple selection and deletion is the first one to change...</p>
<p dir="auto">The design of KDE's digiKam is complicated and I can't have direct access to treeView to ask for selected items. Instead, I should stick to this design, but I accept all suggestions :)</p>
]]></description><link>https://forum.qt.io/post/187206</link><guid isPermaLink="true">https://forum.qt.io/post/187206</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 19 Jul 2013 20:44:46 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t store a QPointer into a QVariant on Fri, 19 Jul 2013 20:08:26 GMT]]></title><description><![CDATA[<p dir="auto">You can use quintptr but are you sure that having that in the action is the best design ?</p>
]]></description><link>https://forum.qt.io/post/187193</link><guid isPermaLink="true">https://forum.qt.io/post/187193</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 19 Jul 2013 20:08:26 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t store a QPointer into a QVariant on Fri, 19 Jul 2013 19:30:33 GMT]]></title><description><![CDATA[<p dir="auto">So a container won't work...</p>
<p dir="auto">Any idea of how to pass that pointer through QAction?</p>
]]></description><link>https://forum.qt.io/post/187187</link><guid isPermaLink="true">https://forum.qt.io/post/187187</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 19 Jul 2013 19:30:33 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t store a QPointer into a QVariant on Fri, 19 Jul 2013 14:11:27 GMT]]></title><description><![CDATA[<p dir="auto">QVector does not subclass QObject, so it is not a QObject.</p>
]]></description><link>https://forum.qt.io/post/187161</link><guid isPermaLink="true">https://forum.qt.io/post/187161</guid><dc:creator><![CDATA[JKSH]]></dc:creator><pubDate>Fri, 19 Jul 2013 14:11:27 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t store a QPointer into a QVariant on Fri, 19 Jul 2013 14:03:40 GMT]]></title><description><![CDATA[<p dir="auto">No, QVector is not a QObject, it's a templated container (you can verify in the source code).</p>
]]></description><link>https://forum.qt.io/post/187158</link><guid isPermaLink="true">https://forum.qt.io/post/187158</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 19 Jul 2013 14:03:40 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t store a QPointer into a QVariant on Fri, 19 Jul 2013 13:57:02 GMT]]></title><description><![CDATA[<p dir="auto">But, QVector is a QObject, I only added a template argument to it...</p>
<p dir="auto">I can't use QPointer&lt;QVector&gt;(data)  because of template mismatch.</p>
]]></description><link>https://forum.qt.io/post/187157</link><guid isPermaLink="true">https://forum.qt.io/post/187157</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 19 Jul 2013 13:57:02 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t store a QPointer into a QVariant on Fri, 19 Jul 2013 13:47:08 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">QPointer must be used with QObject, have a look at "this":<a href="http://qt-project.org/doc/qt-4.8/qpointer.html#details" target="_blank" rel="noopener noreferrer nofollow ugc">http://qt-project.org/doc/qt-4.8/qpointer.html#details</a></p>
]]></description><link>https://forum.qt.io/post/187154</link><guid isPermaLink="true">https://forum.qt.io/post/187154</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 19 Jul 2013 13:47:08 GMT</pubDate></item></channel></rss>