How to stop opening the same record in a new window more than once in QTableView?
<p>I need some 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 ?</p>

<p>this is what I have so far</p>

<pre><code>while(qry.next())
    {
        QSqlQueryModel *model = new QSqlQueryModel();
        model-&gt;setQuery(qry);
    }
    connect(ui-&gt;tableView_visitLog, SIGNAL(pressed(const QModelIndex&amp;)),this,
            SLOT(on_tableView_visitorLog_clicked(const QModelIndex&amp;)));


 void ControlPanel::on_tableView_visitorLog_clicked(const QModelIndex&amp; index)
 {
    const QAbstractItemModel* tableModel = ui-&gt;tableView_visitLog-&gt;model();
    int id = tableModel-&gt;data(tableModel-&gt;index(index.row(),0),Qt::DisplayRole).toInt();
    visitordetails = new VisitorDetails(id, this);
    visitordetails-&gt;show();
 }
</code></pre>