Merge pull request #813 from RumovZ/fix-search-combos
Fix clicking filters with keyboard modifiers
This commit is contained in:
commit
b38218f7c6
@ -1211,27 +1211,28 @@ QTableView {{ gridline-color: {grid} }}
|
|||||||
else:
|
else:
|
||||||
txt = ""
|
txt = ""
|
||||||
items = []
|
items = []
|
||||||
for c, a in enumerate(args):
|
for i, a in enumerate(args):
|
||||||
if c % 2 == 0:
|
if i % 2 == 0:
|
||||||
txt += a + ":"
|
txt += a + ":"
|
||||||
else:
|
else:
|
||||||
txt += re.sub(r"(\*|%|_)", r"\\\1", a)
|
txt += re.sub("[*%_]", r"\\\g<0>", a)
|
||||||
for chr in ' ()"':
|
for c in ' ()"':
|
||||||
if chr in txt:
|
if c in txt:
|
||||||
txt = '"%s"' % txt.replace('"', '\\"')
|
txt = '"{}"'.format(txt.replace('"', '\\"'))
|
||||||
break
|
break
|
||||||
items.append(txt)
|
items.append(txt)
|
||||||
txt = ""
|
txt = ""
|
||||||
txt = " ".join(items)
|
txt = " ".join(items)
|
||||||
|
# is there something to replace or append with?
|
||||||
|
if txt:
|
||||||
if self.mw.app.keyboardModifiers() & Qt.AltModifier:
|
if self.mw.app.keyboardModifiers() & Qt.AltModifier:
|
||||||
txt = "-" + txt
|
txt = "-" + txt
|
||||||
if self.mw.app.keyboardModifiers() & Qt.ControlModifier:
|
# is there something to replace or append to?
|
||||||
cur = str(self.form.searchEdit.lineEdit().text())
|
cur = str(self.form.searchEdit.lineEdit().text())
|
||||||
if cur and cur != self._searchPrompt:
|
if cur and cur != self._searchPrompt:
|
||||||
|
if self.mw.app.keyboardModifiers() & Qt.ControlModifier:
|
||||||
txt = cur + " " + txt
|
txt = cur + " " + txt
|
||||||
elif self.mw.app.keyboardModifiers() & Qt.ShiftModifier:
|
elif self.mw.app.keyboardModifiers() & Qt.ShiftModifier:
|
||||||
cur = str(self.form.searchEdit.lineEdit().text())
|
|
||||||
if cur:
|
|
||||||
txt = cur + " or " + txt
|
txt = cur + " or " + txt
|
||||||
self.form.searchEdit.lineEdit().setText(txt)
|
self.form.searchEdit.lineEdit().setText(txt)
|
||||||
self.onSearchActivated()
|
self.onSearchActivated()
|
||||||
|
Loading…
Reference in New Issue
Block a user