I'm trying to make a interface that's easy to use. I have 2 list one of them list of device already using and the other one is unused ones. So, I'm trying to do add drag and drop feature. Like this.
But mine is like this. I cannot drag or drop with QSqlQueryModel.(I used listview)
The codes i wrote for listview like this.
ui->listViewMusteri->setDragEnabled(true);
ui->listViewMusteri->setAcceptDrops(true);
ui->listViewMusteri->setDropIndicatorShown(true);
ui->listViewMusteri->setDefaultDropAction(Qt::MoveAction);
ui->listViewToplam->setDragEnabled(true);
ui->listViewToplam->setAcceptDrops(true);
ui->listViewToplam->setDropIndicatorShown(true);
ui->listViewToplam->setDefaultDropAction(Qt::MoveAction);
void InformationMusteriDialog::fillListViews() {
QSqlQueryModel *model = new QSqlQueryModel();
if(database.isOpen()) {
QSqlQuery* qry = new QSqlQuery(database);
qry->prepare("SELECT `Cihaz Seri No` From `cihazisim`");
qry -> exec();
model->setQuery(*qry);
ui->listViewToplam->setModel(model);
}
}
Please let me know if more information or explanation is required.