Revert "experiment with using right click for AND/OR/NOT"
This reverts commit 9048a1ff3c
and
manually comments out the setSelectionMode() call.
Switching back to the old behaviour until issues can be worked through.
https://forums.ankiweb.net/t/anki-2-1-41-beta/7305/24
This commit is contained in:
parent
2a585c5e5a
commit
67d612926c
@ -291,7 +291,8 @@ class SidebarTreeView(QTreeView):
|
|||||||
self.col = self.mw.col
|
self.col = self.mw.col
|
||||||
self.current_search: Optional[str] = None
|
self.current_search: Optional[str] = None
|
||||||
|
|
||||||
self.setContextMenuPolicy(Qt.PreventContextMenu)
|
self.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||||
|
self.customContextMenuRequested.connect(self.onContextMenu) # type: ignore
|
||||||
self.context_menus: Dict[SidebarItemType, Sequence[Tuple[str, Callable]]] = {
|
self.context_menus: Dict[SidebarItemType, Sequence[Tuple[str, Callable]]] = {
|
||||||
SidebarItemType.DECK: (
|
SidebarItemType.DECK: (
|
||||||
(tr(TR.ACTIONS_RENAME), self.rename_deck),
|
(tr(TR.ACTIONS_RENAME), self.rename_deck),
|
||||||
@ -316,8 +317,8 @@ class SidebarTreeView(QTreeView):
|
|||||||
self.setIndentation(15)
|
self.setIndentation(15)
|
||||||
self.setAutoExpandDelay(600)
|
self.setAutoExpandDelay(600)
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
mode = QAbstractItemView.SelectionMode.ExtendedSelection # type: ignore
|
# mode = QAbstractItemView.SelectionMode.ExtendedSelection # type: ignore
|
||||||
self.setSelectionMode(mode)
|
# self.setSelectionMode(mode)
|
||||||
self.setDragDropMode(QAbstractItemView.InternalMove)
|
self.setDragDropMode(QAbstractItemView.InternalMove)
|
||||||
self.setDragDropOverwriteMode(False)
|
self.setDragDropOverwriteMode(False)
|
||||||
|
|
||||||
@ -433,13 +434,7 @@ class SidebarTreeView(QTreeView):
|
|||||||
def mouseReleaseEvent(self, event: QMouseEvent) -> None:
|
def mouseReleaseEvent(self, event: QMouseEvent) -> None:
|
||||||
super().mouseReleaseEvent(event)
|
super().mouseReleaseEvent(event)
|
||||||
if event.button() == Qt.LeftButton:
|
if event.button() == Qt.LeftButton:
|
||||||
if not self._keyboard_modified_pressed():
|
self._on_click_current()
|
||||||
self._on_click_current()
|
|
||||||
elif event.button() == Qt.RightButton:
|
|
||||||
if self._keyboard_modified_pressed():
|
|
||||||
self._on_click_current()
|
|
||||||
else:
|
|
||||||
self.onContextMenu(event.pos())
|
|
||||||
|
|
||||||
def keyPressEvent(self, event: QKeyEvent) -> None:
|
def keyPressEvent(self, event: QKeyEvent) -> None:
|
||||||
if event.key() in (Qt.Key_Return, Qt.Key_Enter):
|
if event.key() in (Qt.Key_Return, Qt.Key_Enter):
|
||||||
@ -447,10 +442,6 @@ class SidebarTreeView(QTreeView):
|
|||||||
else:
|
else:
|
||||||
super().keyPressEvent(event)
|
super().keyPressEvent(event)
|
||||||
|
|
||||||
def _keyboard_modified_pressed(self) -> bool:
|
|
||||||
mods = self.mw.app.keyboardModifiers()
|
|
||||||
return bool(mods & (Qt.ShiftModifier | Qt.AltModifier | Qt.ControlModifier))
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
|
|
||||||
def handle_drag_drop(self, sources: List[SidebarItem], target: SidebarItem) -> bool:
|
def handle_drag_drop(self, sources: List[SidebarItem], target: SidebarItem) -> bool:
|
||||||
|
Loading…
Reference in New Issue
Block a user