python 3.10: fix some deprecation warnings and compat with 3.10
This commit is contained in:
@@ -213,8 +213,8 @@ class QrReaderCameraDialog(Logger, MessageBoxMixin, QDialog):
|
||||
"""
|
||||
Returns a QRect that is scan_size x scan_size in the middle of the resolution
|
||||
"""
|
||||
scan_pos_x = (resolution.width() - scan_size) / 2
|
||||
scan_pos_y = (resolution.height() - scan_size) / 2
|
||||
scan_pos_x = (resolution.width() - scan_size) // 2
|
||||
scan_pos_y = (resolution.height() - scan_size) // 2
|
||||
return QRect(scan_pos_x, scan_pos_y, scan_size, scan_size)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -63,7 +63,7 @@ class QrReaderVideoOverlay(QWidget):
|
||||
self.bg_rect_pen = QPen()
|
||||
self.bg_rect_pen.setColor(Qt.black)
|
||||
self.bg_rect_pen.setStyle(Qt.DotLine)
|
||||
self.bg_rect_fill = QColor(255, 255, 255, 255 * self.BG_RECT_OPACITY)
|
||||
self.bg_rect_fill = QColor(255, 255, 255, int(255 * self.BG_RECT_OPACITY))
|
||||
|
||||
def set_results(self, results: List[QrCodeResult], flip_x: bool,
|
||||
validator_results: QrReaderValidatorResult):
|
||||
|
||||
@@ -60,7 +60,7 @@ class QrReaderVideoSurface(QAbstractVideoSurface):
|
||||
return False
|
||||
|
||||
try:
|
||||
img = QImage(frame.bits(), frame.width(), frame.height(), image_format)
|
||||
img = QImage(int(frame.bits()), frame.width(), frame.height(), image_format)
|
||||
|
||||
# Check whether we need to flip the image on any axis
|
||||
surface_format = self.surfaceFormat()
|
||||
|
||||
Reference in New Issue
Block a user