fix reverse focus move on listView

This commit is contained in:
Cyril Anisimov 2024-10-19 22:20:35 +02:00
parent ada3f9a7fa
commit 626b9e1e76

View file

@ -109,6 +109,7 @@ void ListViewFocusController::viewAtCurrentIndex()
{ {
switch(m_currentSection) { switch(m_currentSection) {
case Section::Default: case Section::Default:
[[fallthrough]];
case Section::Header: { case Section::Header: {
QMetaObject::invokeMethod(m_listView, "positionViewAtBeginning"); QMetaObject::invokeMethod(m_listView, "positionViewAtBeginning");
break; break;
@ -146,12 +147,14 @@ void ListViewFocusController::nextDelegate()
viewToBegin(); viewToBegin();
break; break;
} }
[[fallthrough]];
} }
case Section::Header: { case Section::Header: {
if (size() > 0) { if (size() > 0) {
m_currentSection = Section::Delegate; m_currentSection = Section::Delegate;
break; break;
} }
[[fallthrough]];
} }
case Section::Delegate: case Section::Delegate:
if (m_delegateIndex < (size() - 1)) { if (m_delegateIndex < (size() - 1)) {
@ -162,6 +165,7 @@ void ListViewFocusController::nextDelegate()
viewToEnd(); viewToEnd();
break; break;
} }
[[fallthrough]];
case Section::Footer: { case Section::Footer: {
m_isReturnNeeded = true; m_isReturnNeeded = true;
m_currentSection = Section::Default; m_currentSection = Section::Default;
@ -182,12 +186,15 @@ void ListViewFocusController::previousDelegate()
m_currentSection = Section::Footer; m_currentSection = Section::Footer;
break; break;
} }
[[fallthrough]];
} }
case Section::Footer: { case Section::Footer: {
if (size() > 0) { if (size() > 0) {
m_currentSection = Section::Delegate; m_currentSection = Section::Delegate;
m_delegateIndex = size() - 1;
break; break;
} }
[[fallthrough]];
} }
case Section::Delegate: { case Section::Delegate: {
if (m_delegateIndex > 0) { if (m_delegateIndex > 0) {
@ -197,6 +204,7 @@ void ListViewFocusController::previousDelegate()
m_currentSection = Section::Header; m_currentSection = Section::Header;
break; break;
} }
[[fallthrough]];
} }
case Section::Header: { case Section::Header: {
m_isReturnNeeded = true; m_isReturnNeeded = true;