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...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
Muhammad Bashir Al-Noimi
Sent: Sunday, 21 April 2013 12:43 PM
To: interest@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
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to