From 775b5e7e8ac78200151fb5575bf1c951f6ab0774 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Tue, 13 Jun 2023 18:31:39 +0200 Subject: [PATCH] correct tab behavior after value change (part of #79) --- src/gui_qt/data/valueeditwidget.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui_qt/data/valueeditwidget.py b/src/gui_qt/data/valueeditwidget.py index 540c268..c85f1d1 100644 --- a/src/gui_qt/data/valueeditwidget.py +++ b/src/gui_qt/data/valueeditwidget.py @@ -188,7 +188,15 @@ class ValueEditWidget(QtWidgets.QWidget, Ui_MaskDialog): new_value = complex(val) new_value = new_value.real if new_value.imag == 0 else new_value + # table view loses focus when itemChanged is emitted + # if edit of item is cause of change resume editing at next item + prev_state = self.tableView.state() + idx = self.tableView.currentIndex() + idx = idx.sibling((col+1)//3+row, (col+1) % 3) self.itemChanged.emit(sid, (col, row), new_value) + if prev_state == self.tableView.State.EditingState: + self.tableView.setCurrentIndex(idx) + self.tableView.edit(idx) @QtCore.pyqtSlot(QtCore.QItemSelection, QtCore.QItemSelection) def show_position(self, *_):