#include <QListView>
#include <QMessageBox>
#include <QPushButton>
+#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QTextEdit>
QHBoxLayout*hl;
setLayout(vl=new QVBoxLayout);
vl->addLayout(hl=new QHBoxLayout,10);
- hl->addWidget(m_listview=new QListView,10);
- m_listview->setModel(m_listmodel=new QStandardItemModel(this));
+ hl->addLayout(vl2=new QVBoxLayout,10);
+ vl2->addWidget(m_filter=new QLineEdit,0);
+ vl2->addWidget(m_listview=new QListView,10);
+ m_listmodel=new QStandardItemModel(this);
+ m_proxymodel=new QSortFilterProxyModel(this);
+ m_proxymodel->setSourceModel(m_listmodel);
+ connect(m_filter,SIGNAL(textChanged(const QString&)),m_proxymodel,SLOT(setFilterFixedString(const QString&)));
+ m_proxymodel->setFilterCaseSensitivity(Qt::CaseInsensitive);
+ m_listview->setModel(m_proxymodel);
m_listview->setEditTriggers(QAbstractItemView::NoEditTriggers);
hl->addLayout(vl2=new QVBoxLayout,0);
QPushButton*p;
class QListView;
class QStandardItemModel;
+class QSortFilterProxyModel;
+class QLineEdit;
/**shows a list of customers, lets the user select and offers to alter/create customers*/
class MCustomerListDialog:public QDialog
QList<MCustomer> m_list;
QListView*m_listview;
QStandardItemModel*m_listmodel;
+ QSortFilterProxyModel*m_proxymodel;
+ QLineEdit*m_filter;
MWebRequest*m_req;
/**updates internal list*/