mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-06 01:54:01 +02:00
More PyQt6 nonsense
This commit is contained in:
parent
5a1e2ef09e
commit
31db05e960
1 changed files with 8 additions and 7 deletions
|
|
@ -506,8 +506,8 @@ def rect_for_trim(self):
|
|||
return get_selection_rect(img, sr, target)
|
||||
|
||||
def mousePressEvent(self, ev):
|
||||
if ev.button() == Qt.MouseButton.LeftButton and self.target.contains(ev.pos()):
|
||||
pos = ev.pos()
|
||||
if ev.button() == Qt.MouseButton.LeftButton and self.target.contains(ev.position()):
|
||||
pos = ev.position()
|
||||
self.selection_state.last_press_point = pos
|
||||
if self.selection_state.current_mode is None:
|
||||
self.selection_state.current_mode = 'select'
|
||||
|
|
@ -528,10 +528,10 @@ def mouseMoveEvent(self, ev):
|
|||
changed = True
|
||||
self.selection_state.in_selection = False
|
||||
self.selection_state.drag_corner = None
|
||||
pos = ev.pos()
|
||||
pos = ev.position()
|
||||
cursor = Qt.CursorShape.ArrowCursor
|
||||
try:
|
||||
if not self.target.contains(pos):
|
||||
if not self.target.contains(QPointF(pos)):
|
||||
return
|
||||
if ev.buttons() & Qt.MouseButton.LeftButton:
|
||||
if self.selection_state.last_press_point is not None and self.selection_state.current_mode is not None:
|
||||
|
|
@ -547,10 +547,10 @@ def mouseMoveEvent(self, ev):
|
|||
cursor = self.get_cursor()
|
||||
changed = True
|
||||
else:
|
||||
if self.selection_state.rect is None or not self.selection_state.rect.contains(pos):
|
||||
if self.selection_state.rect is None or not self.selection_state.rect.contains(QPointF(pos)):
|
||||
return
|
||||
if self.selection_state.current_mode == 'selected':
|
||||
if self.selection_state.rect is not None and self.selection_state.rect.contains(pos):
|
||||
if self.selection_state.rect is not None and self.selection_state.rect.contains(QPointF(pos)):
|
||||
self.selection_state.drag_corner = self.get_drag_corner(pos)
|
||||
self.selection_state.in_selection = True
|
||||
cursor = self.get_cursor()
|
||||
|
|
@ -570,7 +570,8 @@ def mouseReleaseEvent(self, ev):
|
|||
else:
|
||||
self.selection_state.current_mode = 'selected'
|
||||
self.selection_state_changed.emit(self.has_selection)
|
||||
elif self.selection_state.current_mode == 'selected' and self.selection_state.rect is not None and self.selection_state.rect.contains(ev.pos()):
|
||||
elif self.selection_state.current_mode == 'selected' and self.selection_state.rect is not None and self.selection_state.rect.contains(
|
||||
ev.position()):
|
||||
self.setCursor(self.get_cursor())
|
||||
self.update()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue