--- a/Snapshot/SnapshotRegionGrabber.py Fri Nov 01 15:48:48 2013 +0100 +++ b/Snapshot/SnapshotRegionGrabber.py Sun Nov 03 15:58:22 2013 +0100 @@ -197,7 +197,7 @@ boundingRect.moveCenter(r.center()) textRect.moveCenter(r.center()) elif r.y() - 3 > textRect.height() and \ - r.x() + textRect.width() < self.rect().width(): + r.x() + textRect.width() < self.rect().width(): # on top, left aligned boundingRect.moveBottomLeft(QPoint(r.x(), r.y() - 3)) textRect.moveBottomLeft(QPoint(r.x() + 2, r.y() - 3)) @@ -206,7 +206,7 @@ boundingRect.moveTopRight(QPoint(r.x() - 3, r.y())) textRect.moveTopRight(QPoint(r.x() - 5, r.y())) elif r.bottom() + 3 + textRect.height() < self.rect().bottom() and \ - r.right() > textRect.width(): + r.right() > textRect.width(): # at bottom, right aligned boundingRect.moveTopRight(QPoint(r.right(), r.bottom() + 3)) textRect.moveTopRight(QPoint(r.right() - 2, r.bottom() + 3)) @@ -220,7 +220,7 @@ drawRect(painter, boundingRect, textColor, textBackgroundColor) painter.drawText(textRect, Qt.AlignHCenter, txt) - if (r.height() > self.__handleSize * 2 and \ + if (r.height() > self.__handleSize * 2 and r.width() > self.__handleSize * 2) or \ not self.__mouseDown: self.__updateHandles() @@ -299,7 +299,7 @@ s = self.__selectionBeforeDrag.normalized() p = s.topLeft() + evt.pos() - self.__dragStartPoint r.setBottomRight( - r.bottomRight() - QPoint(s.width(), s.height()) + + r.bottomRight() - QPoint(s.width(), s.height()) + QPoint(1, 1)) if not r.isNull() and r.isValid(): self.__selection.moveTo(self.__limitPointToRect(p, r)) @@ -462,18 +462,18 @@ @param sel selection to be normalized (QRect) @return normalized selection (QRect) """ - r = QRect(sel) - if r.width() <= 0: - l = r.left() - w = r.width() - r.setLeft(l + w - 1) - r.setRight(l) - if r.height() <= 0: - t = r.top() - h = r.height() - r.setTop(t + h - 1) - r.setBottom(t) - return r + rect = QRect(sel) + if rect.width() <= 0: + left = rect.left() + width = rect.width() + rect.setLeft(left + width - 1) + rect.setRight(left) + if rect.height() <= 0: + top = rect.top() + height = rect.height() + rect.setTop(top + height - 1) + rect.setBottom(top) + return rect def __grabRect(self): """ @@ -495,8 +495,8 @@ pt.begin(pixmap2) if pt.paintEngine().hasFeature(QPaintEngine.PorterDuff): pt.setRenderHints( - QPainter.Antialiasing | \ - QPainter.HighQualityAntialiasing | \ + QPainter.Antialiasing | + QPainter.HighQualityAntialiasing | QPainter.SmoothPixmapTransform, True) pt.setBrush(Qt.black)