Hi All,
I wonder if anyone can help, I have a QTableView where I'm displaying list of records, to display further details of any record I'm opening a new window by clicking on the record, all well apart from that I can open the SAME record more than once, How can I prevent this happening ?
this is what I have so far
while(qry.next())
{
model->setQuery(qry);
}
connect(ui->tableView_visitLog, SIGNAL(pressed(const QModelIndex&)), this,
SLOT(on_tableView_visitorLog_clicked(const QModelIndex&)));
void ControlPanel::on_tableView_visitorLog_clicked(const QModelIndex& index)
{
int visitor_id = tableModel->data(tableModel->index(index.row(),0), Qt::DisplayRole).toInt();
visitordetails = new VisitorDetails(visitor_id, this);
visitordetails->show();
}
while(qry.next())
{
QSqlQueryModel *model = new QSqlQueryModel();
model->setQuery(qry);
}
connect(ui->tableView_visitLog, SIGNAL(pressed(const QModelIndex&)), this,
SLOT(on_tableView_visitorLog_clicked(const QModelIndex&)));
void ControlPanel::on_tableView_visitorLog_clicked(const QModelIndex& index)
{
const QAbstractItemModel* tableModel = ui->tableView_visitLog->model();
int visitor_id = tableModel->data(tableModel->index(index.row(),0), Qt::DisplayRole).toInt();
visitordetails = new VisitorDetails(visitor_id, this);
visitordetails->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks