Prevent right-click for popup menus to select item (fix #919)

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
TheJackiMonster 2023-02-13 21:34:35 +01:00
parent a6ac2705d5
commit 6ea209e523
No known key found for this signature in database
GPG key ID: D850A5F772E880F9
2 changed files with 13 additions and 0 deletions

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# --!-- coding: utf8 --!--
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QTreeView, QHeaderView
from manuskript import settings
@ -83,6 +84,12 @@ class outlineView(QTreeView, dndView, outlineBasics):
dndView.dragMoveEvent(self, event)
QTreeView.dragMoveEvent(self, event)
def mousePressEvent(self, event):
# Prevent selecting item while right-clicking for popup menu!
if event.button() != Qt.RightButton:
QTreeView.mousePressEvent(self, event)
outlineBasics.mousePressEvent(self, event)
def mouseReleaseEvent(self, event):
QTreeView.mouseReleaseEvent(self, event)
outlineBasics.mouseReleaseEvent(self, event)

View file

@ -90,6 +90,12 @@ class treeView(QTreeView, dndView, outlineBasics):
dndView.dragMoveEvent(self, event)
QTreeView.dragMoveEvent(self, event)
def mousePressEvent(self, event):
# Prevent selecting item while right-clicking for popup menu!
if event.button() != Qt.RightButton:
QTreeView.mousePressEvent(self, event)
outlineBasics.mousePressEvent(self, event)
def mouseReleaseEvent(self, event):
QTreeView.mouseReleaseEvent(self, event)
outlineBasics.mouseReleaseEvent(self, event)