Hi!
I'm developing a customer library. I have a model and a view class:
{
//...
public slots:
void setSeachString
(const QString & str
){ _vec_restricted.clear();
foreach(Customer * c, _vec_all)
if(c->contains(str)) _vec_restricted.append(c);
}
private:
QVector<Customer*> _vec_all;
QVector<Customer*> _vec_restricted;
}
{
//...
}
class CustomerLibrary : public QAbstractTableModel
{
//...
public slots:
void setSeachString (const QString & str){
_vec_restricted.clear();
foreach(Customer * c, _vec_all)
if(c->contains(str)) _vec_restricted.append(c);
}
private:
QVector<Customer*> _vec_all;
QVector<Customer*> _vec_restricted;
}
class CustomerTableView : public QTableView
{
//...
}
To copy to clipboard, switch view to plain text mode
Ok, in order to find quickly an entry, I have a LineEdit whose textChanged signal is connected to the setSearchString(...) method.
So anytime the text changes, drastic changes happen to my model.
How can I inform the view that an update is necessary?
Also I do not want to remove the rows one by one.
Thnaks in advance,
Olli
Bookmarks