Merge pull request #813 from RumovZ/fix-search-combos
Fix clicking filters with keyboard modifiers
This commit is contained in:
commit
b38218f7c6
@ -1211,28 +1211,29 @@ 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)
|
||||||
if self.mw.app.keyboardModifiers() & Qt.AltModifier:
|
# is there something to replace or append with?
|
||||||
txt = "-" + txt
|
if txt:
|
||||||
if self.mw.app.keyboardModifiers() & Qt.ControlModifier:
|
if self.mw.app.keyboardModifiers() & Qt.AltModifier:
|
||||||
|
txt = "-" + txt
|
||||||
|
# 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:
|
||||||
txt = cur + " " + txt
|
if self.mw.app.keyboardModifiers() & Qt.ControlModifier:
|
||||||
elif self.mw.app.keyboardModifiers() & Qt.ShiftModifier:
|
txt = cur + " " + txt
|
||||||
cur = str(self.form.searchEdit.lineEdit().text())
|
elif self.mw.app.keyboardModifiers() & Qt.ShiftModifier:
|
||||||
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