<?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[How to enable drag row from QtableView(QSqlQueryModel) to other Qtableview(QAbstractTableModel)?]]></title><description><![CDATA[<p dir="auto">I need to be able drag row from QtableView A  that is using QSqlQueryModel to simple QTableView B<br />
i followed few links in the net and implemented all info i could find , but still i even can't see the mouse indicator enable me to start the drag from table A and the method in table B not even triggered .<br />
in Table A (QSqlQueryModel)<br />
i set in flags<br />
@Qt::ItemFlags PlayListSqlModel::flags(<br />
const QModelIndex &amp;index) const<br />
{<br />
Qt::ItemFlags defaultFlags = QSqlQueryModel::flags(index);</p>
<p dir="auto">if (index.isValid())<br />
return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags |Qt::ItemIsSelectable;</p>
<p dir="auto">return defaultFlags;<br />
}@</p>
<p dir="auto">in Table B i set :<br />
@Qt::ItemFlags PlayListPlayerModel::flags( const QModelIndex &amp;index ) const<br />
{</p>
<p dir="auto">Qt::ItemFlags defaultFlags = QAbstractTableModel::flags(index);</p>
<pre><code>if (index.isValid())
    return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags |Qt::ItemIsSelectable;
else
    return Qt::ItemIsDropEnabled | defaultFlags | Qt::ItemIsSelectable;
</code></pre>
<p dir="auto">}@</p>
<p dir="auto">also in table B i implemented all the drop methods in the model class</p>
]]></description><link>https://forum.qt.io/topic/14554/how-to-enable-drag-row-from-qtableview-qsqlquerymodel-to-other-qtableview-qabstracttablemodel</link><generator>RSS for Node</generator><lastBuildDate>Wed, 11 Nov 2026 22:18:25 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/14554.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 01 Mar 2012 06:09:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to enable drag row from QtableView(QSqlQueryModel) to other Qtableview(QAbstractTableModel)? on Thu, 01 Mar 2012 16:28:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I was trying to do something similar ...drag from a QListWidget to a QTreeWidget. Adding<br />
@<br />
setAcceptDrops()<br />
@<br />
to 'true' (for QTreeWidget) worked for me.</p>
<p dir="auto">Hope this helps.</p>
]]></description><link>https://forum.qt.io/post/131080</link><guid isPermaLink="true">https://forum.qt.io/post/131080</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 01 Mar 2012 16:28:28 GMT</pubDate></item></channel></rss>