From 426421914460bbf038921491135ca1b05f1b8f8e Mon Sep 17 00:00:00 2001 From: Ogi Moore Date: Mon, 31 May 2021 21:29:30 -0700 Subject: [PATCH] Add PyQt6 version check for QByteArray creation --- pyqtgraph/functions.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyqtgraph/functions.py b/pyqtgraph/functions.py index af73083b..d81a7d0f 100644 --- a/pyqtgraph/functions.py +++ b/pyqtgraph/functions.py @@ -1708,8 +1708,7 @@ def arrayToQPath(x, y, connect='all', finiteCheck=True): # make connect argument contain only str type connect_array, connect = connect, 'array' - qtver = [int(x) for x in QtVersion.split('.')] - qt6 = qtver[0] == 6 + qt6 = QtVersion.startswith("6") use_qpolygonf = connect == 'all' or (qt6 and connect in ['pairs', 'finite']) @@ -1731,7 +1730,7 @@ def arrayToQPath(x, y, connect='all', finiteCheck=True): # inf/nans completely prevent the plot from being displayed starting on # Qt version 5.12.3; these must now be manually cleaned out. isfinite = None - + qtver = [int(x) for x in QtVersion.split('.')] if connect == 'finite' and qt6: # we must preserve NaN values here pass @@ -1794,7 +1793,7 @@ def arrayToQPath(x, y, connect='all', finiteCheck=True): # create QDataStream object and stream into QPainterPath path.strn = backstore - if QT_LIB == "PyQt6": + if QT_LIB == "PyQt6" and QtCore.PYQT_VERSION < 0x60101: # due to issue detailed here: # https://www.riverbankcomputing.com/pipermail/pyqt/2021-May/043942.html buf = QtCore.QByteArray(path.strn, len(path.strn))