[Interest] QCompleter::currentIndex issue

Tony Rietwyk tony at rightsoft.com.au
Mon Apr 22 03:33:39 CEST 2013


Hi Muhammad, 

 

I haven't used QCompleter, and I agree that the documentation is vague and crying out for a diagram.  From my reading, the currentIndex only relates to the proxy completionModel, not your original model.   Nowhere does it show how to get the matching entry in your model.  I assume you will have to cast the completionModel to QAbstractProxyModel to map the indexes to your model.  

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com.au at qt-project.org [mailto:interest-bounces+tony=rightsoft.com.au at qt-project.org] On Behalf Of Muhammad Bashir Al-Noimi
Sent: Sunday, 21 April 2013 12:43 PM
To: interest at qt-project.org
Subject: [Interest] QCompleter::currentIndex issue

 

Hi,

I set QCompleter to QLineEdit object… it works fine but I can’t get the current index from QCompleter by currentIndex() because it always return 0 for row index.

PS
I call currentIndex() from QLineEdit editingFinished() slot.



    void MainWindow::on_lineEdit_find_editingFinished()
    {
        if (p_db.isOpen()) {
            /*! \bug Set current row from the completer
             */
            ui->tableView_table->setCurrentIndex(completer->currentIndex());
            qDebug() << completer->currentIndex().row();
        }
    }





-- 
Best Regards,
Muhammad Bashir Al-Noimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130422/7298e794/attachment.html>


More information about the Interest mailing list