<?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[Qt drag and drop rows from one Qtableview to another QTableview]]></title><description><![CDATA[<p dir="auto">0 down vote favorite</p>
<p dir="auto">The following code is used by me to display the contents in a database table in my QTableview (named tableView) when the user click the push button.</p>
<p dir="auto">void firstWindow::on_pushButton_clicked()<br />
{<br />
firstWindow conn;</p>
<pre><code>    QSqlQueryModel * modal = new QSqlQueryModel();
    conn.connOpen();
    QSqlQuery* qry = new QSqlQuery(conn.mydb);
    qry-&gt;prepare("select MESSAGE_ID, DISPLAY_NAME from Message");
    qry-&gt;exec();
    modal-&gt;setQuery(*qry);
    ui-&gt;tableView-&gt;setModel(modal);

    conn.connClose();
    qDebug()&lt;&lt;(modal-&gt;rowCount());
</code></pre>
<p dir="auto">}</p>
<p dir="auto">I want to drag and drop several rows retrieved int to another QTableview (named tableView2)! I searched for many tutorials but could not find a correct one. How can I achieve it?</p>
]]></description><link>https://forum.qt.io/topic/82475/qt-drag-and-drop-rows-from-one-qtableview-to-another-qtableview</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 13:16:00 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/82475.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Aug 2017 11:19:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt drag and drop rows from one Qtableview to another QTableview on Fri, 18 Aug 2017 06:44:04 GMT]]></title><description><![CDATA[<p dir="auto"><em><strong>MOVED topic</strong></em></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lasith">@<bdi>Lasith</bdi></a><br />
read <a href="http://doc.qt.io/qt-5/model-view-programming.html#using-model-view-classes" target="_blank" rel="noopener noreferrer nofollow ugc">this (whole) section</a>.<br />
It shows what methods in the model need to be overwritten to enable drag-n-drop.</p>
]]></description><link>https://forum.qt.io/post/410939</link><guid isPermaLink="true">https://forum.qt.io/post/410939</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Fri, 18 Aug 2017 06:44:04 GMT</pubDate></item></channel></rss>