Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #69 from cognot/master

Give priority to selection over its region.
  • Loading branch information...
commit 3449041432cd0325b7e60bd9854880d94283734a 2 parents d0bf13b + 2608dfe
@wbsoft authored
Showing with 44 additions and 34 deletions.
  1. +44 −34 frescobaldi_app/qpopplerview/surface.py
View
78 frescobaldi_app/qpopplerview/surface.py
@@ -292,22 +292,7 @@ def handleMousePressEvent(self, ev):
# As the event comes from the view, we need to map it locally.
pos = self.mapFromParent(ev.pos())
- # link?
- if self._linksEnabled:
- page, link = self.pageLayout().linkAt(pos)
- if link:
- self.linkClickEvent(ev, page, link)
- return True
- # magnifier?
- if (self._magnifier and
- int(ev.modifiers()) & _SCAM == self._magnifierModifiers and
- ev.button() == Qt.LeftButton):
- self._magnifier.moveCenter(pos)
- self._magnifier.show()
- self._magnifier.raise_()
- self._magnifying = True
- self.setCursor(QCursor(Qt.BlankCursor))
- return True
+
# selecting?
if self._selectionEnabled:
if self.hasSelection():
@@ -325,11 +310,31 @@ def handleMousePressEvent(self, ev):
return True
if not self._selecting:
if ev.button() == Qt.RightButton or int(ev.modifiers()) & _SCAM:
- self._selecting = True
- self._selectionEdge = _RIGHT | _BOTTOM
- self._selectionRect = QRect(pos, QSize(0, 0))
- self._selectionPos = pos
- return True
+ if not (int(ev.modifiers()) & _SCAM == self._magnifierModifiers
+ and ev.button() == Qt.LeftButton):
+ self._selecting = True
+ self._selectionEdge = _RIGHT | _BOTTOM
+ self._selectionRect = QRect(pos, QSize(0, 0))
+ self._selectionPos = pos
+ return True
+
+ # link?
+ if self._linksEnabled:
+ page, link = self.pageLayout().linkAt(pos)
+ if link:
+ self.linkClickEvent(ev, page, link)
+ return True
+ # magnifier?
+ if (self._magnifier and
+ int(ev.modifiers()) & _SCAM == self._magnifierModifiers and
+ ev.button() == Qt.LeftButton):
+ self._magnifier.moveCenter(pos)
+ self._magnifier.show()
+ self._magnifier.raise_()
+ self._magnifying = True
+ self.setCursor(QCursor(Qt.BlankCursor))
+ return True
+
return False
def handleMouseReleaseEvent(self, ev):
@@ -448,7 +453,23 @@ def updateCursor(self, evpos):
"""Set the cursor to the right glyph, depending on action"""
pos = self.mapFromGlobal(evpos)
cursor = None
- if self._linksEnabled:
+ edge = _OUTSIDE
+ if self._selectionEnabled and self.hasSelection():
+ edge = selectionEdge(pos, self.selection())
+
+ if edge is not _OUTSIDE:
+ if edge in (_TOP, _BOTTOM):
+ cursor = Qt.SizeVerCursor
+ elif edge in (_LEFT, _RIGHT):
+ cursor = Qt.SizeHorCursor
+ elif edge in (_LEFT | _TOP, _RIGHT | _BOTTOM):
+ cursor = Qt.SizeFDiagCursor
+ elif edge in (_TOP | _RIGHT, _BOTTOM | _LEFT):
+ cursor = Qt.SizeBDiagCursor
+ elif edge is _INSIDE:
+ cursor = Qt.SizeAllCursor
+
+ elif self._linksEnabled:
page, link = self.pageLayout().linkAt(pos)
if link:
cursor = Qt.PointingHandCursor
@@ -461,18 +482,7 @@ def updateCursor(self, evpos):
self._currentLinkId = lid
if link:
self.linkHoverEnter(page, link)
- if self._selectionEnabled and cursor is None and self.hasSelection():
- edge = selectionEdge(pos, self.selection())
- if edge in (_TOP, _BOTTOM):
- cursor = Qt.SizeVerCursor
- elif edge in (_LEFT, _RIGHT):
- cursor = Qt.SizeHorCursor
- elif edge in (_LEFT | _TOP, _RIGHT | _BOTTOM):
- cursor = Qt.SizeFDiagCursor
- elif edge in (_TOP | _RIGHT, _BOTTOM | _LEFT):
- cursor = Qt.SizeBDiagCursor
- elif edge is _INSIDE:
- cursor = Qt.SizeAllCursor
+
self.setCursor(cursor) if cursor else self.unsetCursor()
def linkHelpEvent(self, globalPos, page, link):

0 comments on commit 3449041

Please sign in to comment.
Something went wrong with that request. Please try again.