diff options
| author | Mark Rowe <mark@vector35.com> | 2025-10-24 08:21:26 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2025-11-04 16:04:04 -0800 |
| commit | ade58079a0a3e6b9d1a0793ab4c084d0f9431f4d (patch) | |
| tree | 1970e1e26858163d24d1359908b529f363789034 /python/examples/triage/exports.py | |
| parent | 63ef49621522efa11e1fcfc709812adb0300d3f6 (diff) | |
Update FilterEdit and FilterTarget to preserve existing selections
The down and enter keys now preserve an existing selection in the
associated list or table views, rather than unconditionally selecting or
activating the first item.
Diffstat (limited to 'python/examples/triage/exports.py')
| -rw-r--r-- | python/examples/triage/exports.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/python/examples/triage/exports.py b/python/examples/triage/exports.py index 730b37df..fb831401 100644 --- a/python/examples/triage/exports.py +++ b/python/examples/triage/exports.py @@ -154,11 +154,14 @@ class ExportsTreeView(QTreeView, FilterTarget): def scrollToCurrentItem(self): self.scrollTo(self.currentIndex()) - def selectFirstItem(self): - self.setCurrentIndex(self.model.index(0, 0, QModelIndex())) + def ensureSelection(self): + if not self.currentIndex().isValid(): + self.setCurrentIndex(self.model.index(0, 0, QModelIndex())) - def activateFirstItem(self): - self.exportDoubleClicked(self.model.index(0, 0, QModelIndex())) + def activateSelection(self): + self.ensureSelection() + if self.currentIndex().isValid(): + self.exportDoubleClicked(self.currentIndex()) def closeFilter(self): self.setFocus(Qt.OtherFocusReason) |
