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
Multimedia
Kdenlive
Commits
8fc74398
Commit
8fc74398
authored
Nov 24, 2020
by
Jean-Baptiste Mardelle
Browse files
After clearing bin filter line, ensure selected item is visible.
Fixes
#845
parent
5e9c863d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
8fc74398
...
...
@@ -875,6 +875,16 @@ Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
// m_searchLine->setClearButtonEnabled(true);
m_searchLine
->
setPlaceholderText
(
i18n
(
"Search..."
));
m_searchLine
->
setFocusPolicy
(
Qt
::
ClickFocus
);
connect
(
m_searchLine
,
&
QLineEdit
::
textChanged
,
[
this
]
(
const
QString
&
str
)
{
m_proxyModel
->
slotSetSearchString
(
str
);
if
(
str
.
isEmpty
())
{
// focus last selected item when clearing search line
QModelIndex
current
=
m_proxyModel
->
selectionModel
()
->
currentIndex
();
if
(
current
.
isValid
())
{
m_itemView
->
scrollTo
(
current
,
QAbstractItemView
::
PositionAtCenter
);
}
}
});
auto
*
leventEater
=
new
LineEventEater
(
this
);
m_searchLine
->
installEventFilter
(
leventEater
);
...
...
@@ -2101,7 +2111,6 @@ void Bin::slotInitView(QAction *action)
});
connect
(
m_proxyModel
.
get
(),
&
ProjectSortProxyModel
::
selectModel
,
this
,
&
Bin
::
selectProxyModel
);
connect
(
m_proxyModel
.
get
(),
&
QAbstractItemModel
::
layoutAboutToBeChanged
,
this
,
&
Bin
::
slotSetSorting
);
connect
(
m_searchLine
,
&
QLineEdit
::
textChanged
,
m_proxyModel
.
get
(),
&
ProjectSortProxyModel
::
slotSetSearchString
);
m_itemView
->
setModel
(
m_proxyModel
.
get
());
m_itemView
->
setSelectionModel
(
m_proxyModel
->
selectionModel
());
m_proxyModel
->
setDynamicSortFilter
(
true
);
...
...
Write
Preview
Markdown
is supported
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