Merge pull request #287 from ales-erjavec/qt5-fix
Qt5 compatifility fixes
This commit is contained in:
commit
63d12c1caa
@ -148,7 +148,7 @@ elif QT_LIB == PYQT5:
|
|||||||
|
|
||||||
# We're using PyQt5 which has a different structure so we're going to use a shim to
|
# We're using PyQt5 which has a different structure so we're going to use a shim to
|
||||||
# recreate the Qt4 structure for Qt5
|
# recreate the Qt4 structure for Qt5
|
||||||
from PyQt5 import QtGui, QtCore, QtWidgets, Qt, uic
|
from PyQt5 import QtGui, QtCore, QtWidgets, uic
|
||||||
try:
|
try:
|
||||||
from PyQt5 import QtSvg
|
from PyQt5 import QtSvg
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -159,10 +159,18 @@ elif QT_LIB == PYQT5:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Re-implement deprecated APIs
|
# Re-implement deprecated APIs
|
||||||
def scale(self, sx, sy):
|
|
||||||
|
__QGraphicsItem_scale = QtWidgets.QGraphicsItem.scale
|
||||||
|
|
||||||
|
def scale(self, *args):
|
||||||
|
if args:
|
||||||
|
sx, sy = args
|
||||||
tr = self.transform()
|
tr = self.transform()
|
||||||
tr.scale(sx, sy)
|
tr.scale(sx, sy)
|
||||||
self.setTransform(tr)
|
self.setTransform(tr)
|
||||||
|
else:
|
||||||
|
return __QGraphicsItem_scale(self)
|
||||||
|
|
||||||
QtWidgets.QGraphicsItem.scale = scale
|
QtWidgets.QGraphicsItem.scale = scale
|
||||||
|
|
||||||
def rotate(self, angle):
|
def rotate(self, angle):
|
||||||
@ -181,8 +189,8 @@ elif QT_LIB == PYQT5:
|
|||||||
self.setContentsMargins(i, i, i, i)
|
self.setContentsMargins(i, i, i, i)
|
||||||
QtWidgets.QGridLayout.setMargin = setMargin
|
QtWidgets.QGridLayout.setMargin = setMargin
|
||||||
|
|
||||||
def setResizeMode(self, mode):
|
def setResizeMode(self, *args):
|
||||||
self.setSectionResizeMode(mode)
|
self.setSectionResizeMode(*args)
|
||||||
QtWidgets.QHeaderView.setResizeMode = setResizeMode
|
QtWidgets.QHeaderView.setResizeMode = setResizeMode
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user