Qt drag and drop rows from one Qtableview to another QTableview
-
0 down vote favorite
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.
void firstWindow::on_pushButton_clicked()
{
firstWindow conn;QSqlQueryModel * modal = new QSqlQueryModel(); conn.connOpen(); QSqlQuery* qry = new QSqlQuery(conn.mydb); qry->prepare("select MESSAGE_ID, DISPLAY_NAME from Message"); qry->exec(); modal->setQuery(*qry); ui->tableView->setModel(modal); conn.connClose(); qDebug()<<(modal->rowCount());}
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?
-
0 down vote favorite
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.
void firstWindow::on_pushButton_clicked()
{
firstWindow conn;QSqlQueryModel * modal = new QSqlQueryModel(); conn.connOpen(); QSqlQuery* qry = new QSqlQuery(conn.mydb); qry->prepare("select MESSAGE_ID, DISPLAY_NAME from Message"); qry->exec(); modal->setQuery(*qry); ui->tableView->setModel(modal); conn.connClose(); qDebug()<<(modal->rowCount());}
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?
MOVED topic
@Lasith
read this (whole) section.
It shows what methods in the model need to be overwritten to enable drag-n-drop.