[konsole] [Bug 411387] Split View crash with keyboard navigation
Nikolay Zlatev
bugzilla_noreply at kde.org
Fri Aug 30 10:15:57 BST 2019
https://bugs.kde.org/show_bug.cgi?id=411387
--- Comment #5 from Nikolay Zlatev <nik at astrapaging.com> ---
Final patch
diff --git a/src/ViewSplitter.cpp b/src/ViewSplitter.cpp
index 7e31172c..38c576a9 100644
--- a/src/ViewSplitter.cpp
+++ b/src/ViewSplitter.cpp
@@ -147,7 +147,7 @@ void ViewSplitter::handleFocusDirection(Qt::Orientation
orientation, int directi
auto parentSplitter =
qobject_cast<ViewSplitter*>(terminalDisplay->parentWidget());
auto topSplitter = parentSplitter->getToplevelSplitter();
- const auto handleWidth = parentSplitter->handleWidth() <= 1 ? 4 :
parentSplitter->handleWidth();
+ const auto handleWidth = parentSplitter->handleWidth() <= 1 ? 4 :
parentSplitter->handleWidth() + 1;
const auto start = QPoint(terminalDisplay->x(), terminalDisplay->y());
const auto startMapped = parentSplitter->mapTo(topSplitter, start);
@@ -163,20 +163,21 @@ void ViewSplitter::handleFocusDirection(Qt::Orientation
orientation, int directi
const auto newPoint = QPoint(newX, newY);
auto child = topSplitter->childAt(newPoint);
+ TerminalDisplay *focusTerminal = nullptr;
if (auto* terminal = qobject_cast<TerminalDisplay*>(child)) {
- terminal->setFocus(Qt::OtherFocusReason);
+ focusTerminal = terminal;
} else if (qobject_cast<QSplitterHandle*>(child) != nullptr) {
auto targetSplitter = qobject_cast<QSplitter*>(child->parent());
- auto splitterTerminal =
qobject_cast<TerminalDisplay*>(targetSplitter->widget(0));
- splitterTerminal->setFocus(Qt::OtherFocusReason);
+ focusTerminal =
qobject_cast<TerminalDisplay*>(targetSplitter->widget(0));
} else if (qobject_cast<QWidget*>(child) != nullptr) {
- TerminalDisplay *terminalParent = nullptr;
- while(terminalParent == nullptr) {
- terminalParent =
qobject_cast<TerminalDisplay*>(child->parentWidget());
+ while(child != nullptr && focusTerminal == nullptr) {
+ focusTerminal =
qobject_cast<TerminalDisplay*>(child->parentWidget());
child = child->parentWidget();
}
- terminalParent->setFocus(Qt::OtherFocusReason);
}
+
+ if (focusTerminal != nullptr)
+ focusTerminal->setFocus(Qt::OtherFocusReason);
}
void ViewSplitter::focusUp()
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the konsole-devel
mailing list