Am Montag, 14. Mai 2007 21:22 schrieb Ingmar Steen: > On 5/14/07, Hans-Peter Jansen <[EMAIL PROTECTED]> wrote: > > Am Montag, 14. Mai 2007 09:56 schrieb Phil Thompson: > > > > > > In C++ pen() returns a const reference - and SIP doesn't support > > > const except to cast it away. I don't know what the C++ compiler is > > > supposed to do in those circumstances - but it looks like it is just > > > discarding any attempts to modify the const QPen. > > > > Hmm, shouldn't this code behave in the same way too, than: > > > > void paintEvent(QPaintEvent* event) > > { > > QPainter p(this); > > QPen pn=p.pen(); > > pn.setWidth(2); > > > > [found in qt3/doc/examples/progress/progress.cpp, line 85] > > A bit off-topic, but the reason the C++ version you referenced works is > because in C++ this will implicitly make a mutable copy of the const QPen > object using QPen's copy constructor. In python, you apparently have to > do that explicitly.
Ahh, the wonders of the overloaded assignment operator <grmpf>. Thanks for clarification, Ingmar. BTW, I think that differences between C++ and Python concerning Qt are perfectly fine here (and generally on this list). I guess, it even generates a nice public (googable) trace for other victims of this issue in the future. Cheers, Pete _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt