Hi,

I want to know how to do a hide/show filter on a QTableView. In the same way as the KDE applications.

I've tried this code but it's too slow:

Qt Code:
  1. void MainWindow::on_lineEdit_textChanged(const QString &text){
  2. FilterThread thread(text, queryModel, tableView);
  3.  
  4. thread.run();
  5. }
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. FilterThread::FilterThread(QString text, QueryModel *model, QTableView *table, QObject *parent):QThread(parent){
  2. m_text=text;
  3. m_model=model;
  4. m_table=table;
  5. }
  6. void FilterThread::run(){
  7. for(int i=0;i<m_model->rowCount();i++){
  8. QString title=m_model->data(m_model->index(i, 3)).toString();
  9.  
  10. m_table->setRowHidden(i, title.indexOf(m_text, 0, Qt::CaseInsensitive)==-1);
  11. }
  12. }
To copy to clipboard, switch view to plain text mode 
Thank's