2016-2018. same code, different result

2016-2018. same code, different result

Anonymous
Not applicable
768 Views
3 Replies
Message 1 of 4

2016-2018. same code, different result

Anonymous
Not applicable

2016 : 

python.execute("from PySide import QtGui, QtCore\
\nclass CustomCheckbox(QtGui.QWidget):\
\n\tdef __init__(self, parent=None):\
\n\t\tsuper(CustomCheckbox, self).__init__(parent=parent)\
\n\tdef paintEvent(self, event): \
\n\t\tpainter = QtGui.QPainter(self)\
\n\t\tbox = QtGui.QStyleOptionButton()\
\n\t\tbox.rect = QtCore.QRect(50, 50, 50, 50)\
\n\t\tbox.state = QtGui.QStyle.State_Enabled\
\n\t\tbox.state = QtGui.QStyle.State_Active\
\n\t\tbox.state = QtGui.QStyle.State_NoChange\
\n\t\tstyle = QtGui.QApplication.instance().style()\
\n\t\tstyle.drawControl(QtGui.QStyle.CE_CheckBox, box, painter)\
\nchk = CustomCheckbox()\
\nchk.show()")

2018 : 

python.execute("from PySide2 import QtWidgets, QtGui, QtCore\
\nclass CustomCheckbox(QtWidgets.QWidget):\
\n\tdef __init__(self, parent=None):\
\n\t\tsuper(CustomCheckbox, self).__init__(parent=parent)\
\n\tdef paintEvent(self, event): \
\n\t\tpainter  = QtGui.QPainter(self)\
\n\t\tbox = QtWidgets.QStyleOptionButton()\
\n\t\tbox.rect = QtCore.QRect(50, 50, 50, 50)\
\n\t\tbox.state = QtWidgets.QStyle.State_Enabled\
\n\t\tbox.state = QtWidgets.QStyle.State_Active\
\n\t\tbox.state = QtWidgets.QStyle.State_NoChange\
\n\t\tstyle = QtWidgets.QApplication.instance().style()\
\n\t\tstyle.drawControl(QtWidgets.QStyle.CE_CheckBox, box, painter)\
\nchk = CustomCheckbox()\
\nchk.show()")

 

 

 

0 Likes
769 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Just to let you know that the problem is that the state State_NoChange does not show the checkbox tristate

0 Likes
Message 3 of 4

malcomarmstrong
Advocate
Advocate

Well, its not exactly the same code. PySide and Pyside2 have some differences, so perhaps there is something in PySide2 that has been updated, omitted or changed between the versions, so there would be some difference in output.

0 Likes
Message 4 of 4

Anonymous
Not applicable

I don't think this is Qt side.

I had the same problem with progress bars : https://forums.autodesk.com/t5/3ds-max-programming/css-error/m-p/8160806

 

I think Autodesk (and others) overrides the css after the load the QApplication.

 

 

0 Likes