mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-28 03:16:16 -04:00
parent
f56fcdd79b
commit
6f64c84c7d
@ -1620,13 +1620,18 @@ bool DatabaseWidget::focusNextPrevChild(bool next)
|
|||||||
// [parent] <-> GroupView <-> TagView <-> EntryView <-> EntryPreview <-> [parent]
|
// [parent] <-> GroupView <-> TagView <-> EntryView <-> EntryPreview <-> [parent]
|
||||||
QList<QWidget*> sequence = {m_groupView, m_tagView, m_entryView, m_previewView};
|
QList<QWidget*> sequence = {m_groupView, m_tagView, m_entryView, m_previewView};
|
||||||
auto widget = qApp->focusWidget();
|
auto widget = qApp->focusWidget();
|
||||||
|
if (!widget) {
|
||||||
|
return QStackedWidget::focusNextPrevChild(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the nearest parent widget in the sequence list
|
||||||
int idx;
|
int idx;
|
||||||
do {
|
do {
|
||||||
idx = sequence.indexOf(widget);
|
idx = sequence.indexOf(widget);
|
||||||
widget = widget->parentWidget();
|
widget = widget->parentWidget();
|
||||||
} while (idx == -1 && widget);
|
} while (idx == -1 && widget);
|
||||||
|
|
||||||
|
// Determine next/previous or wrap around
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
idx = next ? 0 : sequence.size() - 1;
|
idx = next ? 0 : sequence.size() - 1;
|
||||||
} else {
|
} else {
|
||||||
@ -1636,7 +1641,7 @@ bool DatabaseWidget::focusNextPrevChild(bool next)
|
|||||||
// Find the next visible element in the sequence and set the focus
|
// Find the next visible element in the sequence and set the focus
|
||||||
while (idx >= 0 && idx < sequence.size()) {
|
while (idx >= 0 && idx < sequence.size()) {
|
||||||
widget = sequence[idx];
|
widget = sequence[idx];
|
||||||
if (widget->isVisible() && widget->height() > 0 && widget->width() > 0) {
|
if (widget && widget->isVisible() && widget->height() > 0 && widget->width() > 0) {
|
||||||
widget->setFocus();
|
widget->setFocus();
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user