Commit 8691509d authored by Yuri Chornoivan's avatar Yuri Chornoivan

Replace deprecated KFilterProxySearchLine

parent 366dfac1
......@@ -23,11 +23,11 @@
#include <QApplication>
#include <QGridLayout>
#include <QLineEdit>
#include <QMenu>
#include <QPushButton>
#include <QSortFilterProxyModel>
#include <QAction>
#include <KFilterProxySearchLine>
#include <KLocalizedString>
Palapeli::CollectionView::CollectionView(QWidget* parent)
......@@ -63,8 +63,9 @@ Palapeli::CollectionView::CollectionView(QWidget* parent)
m_proxyModel->sort(0, Qt::AscendingOrder);
//TODO: save sorting role between sessions
//setup filter search line
KFilterProxySearchLine* searchLine = new KFilterProxySearchLine(this);
searchLine->setProxy(m_proxyModel);
QLineEdit* searchLine = new QLineEdit(this);
searchLine->setClearButtonEnabled(true);
connect(searchLine, &QLineEdit::textChanged, this, &Palapeli::CollectionView::slotTextChanged);
//setup sort button
QPushButton* sortButton = new QPushButton(i18nc("@action:button that pops up sorting strategy selection menu", "Sort list..."), this);
QMenu* sortMenu = new QMenu(sortButton);
......@@ -87,6 +88,11 @@ Palapeli::CollectionView::CollectionView(QWidget* parent)
// layout->setContentsMargins(0, 0, 0, 0);
}
void Palapeli::CollectionView::slotTextChanged(const QString &str)
{
m_proxyModel->setFilterFixedString(str);
}
void Palapeli::CollectionView::setModel(QAbstractItemModel* model)
{
m_proxyModel->setSourceModel(model);
......
......@@ -44,6 +44,7 @@ namespace Palapeli
void handleActivated(const QModelIndex& index);
void handleSelectionChanged();
void sortMenuTriggered(QAction* action);
void slotTextChanged(const QString &str);
private:
QListView* m_view;
Palapeli::CollectionDelegate* m_delegate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment