mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
More PyQt6 nonsense
This commit is contained in:
parent
ab2b26ddf0
commit
5749582c9b
@ -506,8 +506,8 @@ class Canvas(QWidget):
|
|||||||
return get_selection_rect(img, sr, target)
|
return get_selection_rect(img, sr, target)
|
||||||
|
|
||||||
def mousePressEvent(self, ev):
|
def mousePressEvent(self, ev):
|
||||||
if ev.button() == Qt.MouseButton.LeftButton and self.target.contains(ev.pos()):
|
if ev.button() == Qt.MouseButton.LeftButton and self.target.contains(ev.position()):
|
||||||
pos = ev.pos()
|
pos = ev.position()
|
||||||
self.selection_state.last_press_point = pos
|
self.selection_state.last_press_point = pos
|
||||||
if self.selection_state.current_mode is None:
|
if self.selection_state.current_mode is None:
|
||||||
self.selection_state.current_mode = 'select'
|
self.selection_state.current_mode = 'select'
|
||||||
@ -528,7 +528,7 @@ class Canvas(QWidget):
|
|||||||
changed = True
|
changed = True
|
||||||
self.selection_state.in_selection = False
|
self.selection_state.in_selection = False
|
||||||
self.selection_state.drag_corner = None
|
self.selection_state.drag_corner = None
|
||||||
pos = ev.pos()
|
pos = ev.position()
|
||||||
cursor = Qt.CursorShape.ArrowCursor
|
cursor = Qt.CursorShape.ArrowCursor
|
||||||
try:
|
try:
|
||||||
if ev.buttons() & Qt.MouseButton.LeftButton:
|
if ev.buttons() & Qt.MouseButton.LeftButton:
|
||||||
@ -545,10 +545,10 @@ class Canvas(QWidget):
|
|||||||
cursor = self.get_cursor()
|
cursor = self.get_cursor()
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
if not self.target.contains(pos) or self.selection_state.rect is None or not self.selection_state.rect.contains(pos):
|
if not self.target.contains(QPointF(pos)) or self.selection_state.rect is None or not self.selection_state.rect.contains(QPointF(pos)):
|
||||||
return
|
return
|
||||||
if self.selection_state.current_mode == 'selected':
|
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.drag_corner = self.get_drag_corner(pos)
|
||||||
self.selection_state.in_selection = True
|
self.selection_state.in_selection = True
|
||||||
cursor = self.get_cursor()
|
cursor = self.get_cursor()
|
||||||
@ -568,7 +568,8 @@ class Canvas(QWidget):
|
|||||||
else:
|
else:
|
||||||
self.selection_state.current_mode = 'selected'
|
self.selection_state.current_mode = 'selected'
|
||||||
self.selection_state_changed.emit(self.has_selection)
|
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.setCursor(self.get_cursor())
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user