Message 1 of 4
2016-2018. same code, different result
Not applicable
04-27-2018
01:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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()")