Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
Palapeli
Commits
8691509d
Commit
8691509d
authored
Nov 16, 2019
by
Yuri Chornoivan
Browse files
Replace deprecated KFilterProxySearchLine
parent
366dfac1
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/file-io/collection-view.cpp
View file @
8691509d
...
...
@@ -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
);
...
...
src/file-io/collection-view.h
View file @
8691509d
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment