Would it be to relax the type checking of enum parameters in SIP generated
wrappers, so that both an int argument
and an enum argument are accepted?
I have to change two PyQwt examples to make them work with the current
behaviour. Python pseudo code follows:
...
FIXME = True # Set to True when explicit casts of a 'Python int' to a 'SIP-4.2
enum' are required.
...
# Example 1
# Translation of C++:
# for (int c=0; c<QColorGroup::NColorRoles; c++)
# colorGroup.setColor(c, QColor());
for c in range(QColorGroup.NColorRoles):
if FIXME:
c = QColorGroup.ColorRole(c) # SIP-4.2 needs this "cast" :-/
colorGroup.setColor(c, QColor())
...
# Example 2
# make sliders
# QwtSlider.BgSlot and QwtSlider.BgTrough are enums, and accepted as
such
sldV1 = QwtSlider(self, "", Qt.Vertical, QwtSlider.Left,
QwtSlider.BgSlot)
sldV2 = QwtSlider(self, "", Qt.Vertical, QwtSlider.None,
QwtSlider.BgTrough)
if FIXME:
# Apparently QwtSlider.BgSlot | QwtSlider.BgTrough is not seen as
an enum by SIP-4.2.
# Therefore a cast is required :-(
sldV3 = QwtSlider(
self, "", Qt.Vertical, QwtSlider.Right,
QwtSlider.BGSTYLE(QwtSlider.BgSlot | QwtSlider.BgTrough))
else:
# SIP <= 4.1.1 is happy with the next statement
sldV3 = QwtSlider(self, "", Qt.Vertical, QwtSlider.Right,
QwtSlider.BgSlot | QwtSlider.BgTrough)
I would expect that one can pass a Python int as well as a SIP-4.2 enum
argument into an enum parameter
of a function wrapped by SIP (a C++ function with a C++ enum parameter accepts
C++ int arguments).
Especially example 2 is very quirky, IMO.
Gerard
_______________________________________________
PyKDE mailing list [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde