Clean some key handling

symbol_search
Tyler Goodlet 2021-05-20 14:29:37 -04:00
parent 67498c60af
commit 307afb1935
1 changed files with 13 additions and 8 deletions

View File

@ -694,7 +694,7 @@ class ChartView(ViewBox):
ev.accept() ev.accept()
self.mode.submit_exec() self.mode.submit_exec()
def keyReleaseEvent(self, ev): def keyReleaseEvent(self, ev: QtCore.QEvent):
""" """
Key release to normally to trigger release of input mode Key release to normally to trigger release of input mode
@ -713,6 +713,10 @@ class ChartView(ViewBox):
# if self.state['mouseMode'] == ViewBox.RectMode: # if self.state['mouseMode'] == ViewBox.RectMode:
self.setMouseMode(ViewBox.PanMode) self.setMouseMode(ViewBox.PanMode)
# ctlalt = False
# if (QtCore.Qt.AltModifier | QtCore.Qt.ControlModifier) == mods:
# ctlalt = True
# if self.state['mouseMode'] == ViewBox.RectMode: # if self.state['mouseMode'] == ViewBox.RectMode:
# if key == QtCore.Qt.Key_Space: # if key == QtCore.Qt.Key_Space:
if mods == QtCore.Qt.ControlModifier or key == QtCore.Qt.Key_Control: if mods == QtCore.Qt.ControlModifier or key == QtCore.Qt.Key_Control:
@ -749,19 +753,20 @@ class ChartView(ViewBox):
ctrl = False ctrl = False
if mods == QtCore.Qt.ControlModifier: if mods == QtCore.Qt.ControlModifier:
ctrl = True ctrl = True
if mods == QtCore.Qt.ControlModifier:
self.mode._exec_mode = 'live' self.mode._exec_mode = 'live'
self._key_active = True self._key_active = True
# alt # ctrl + alt
if mods == QtCore.Qt.AltModifier: # ctlalt = False
pass # if (QtCore.Qt.AltModifier | QtCore.Qt.ControlModifier) == mods:
# ctlalt = True
# ctlr-<space>/<l> for "lookup", "search" -> open search tree # ctlr-<space>/<l> for "lookup", "search" -> open search tree
if ctrl and (key == QtCore.Qt.Key_L or key == QtCore.Qt.Key_Space): if ctrl and key in {
QtCore.Qt.Key_L,
QtCore.Qt.Key_Space,
}:
search = self._chart._lc.chart_space.search search = self._chart._lc.chart_space.search
search.focus() search.focus()