[PyKDE] Trouble figuring out QCanvas and QCanvasView
Bryan O'Sullivan
bos at serpentine.com
Wed Oct 6 19:47:03 BST 2004
On Wed, 2004-10-06 at 03:32 -0700, David Boddie wrote:
> That's disappointing to hear.
Think of it as an opportunity to write an article for one of the
developerworks, onlamp and so on sites :-)
> I think that the problem is with the ownership of the QCanvas, although
> it's very strange if that really is the case since you pass it to the
> QCanvasView. I "fixed" your example so that it would work by giving the
> QCanvas a parent when it is created. I've included the modified code below.
You're right! It was just a one-line change that was required. Well,
four bytes really. Thanks. I can safely say that this would not have
occurred to me.
Armed with this knowledge, I checked Troll Tech's Qt documentation,
along with the docs in theKompany's PyQtDoc product, and sure enough,
there's no mention anywhere of the fact that a QCanvas must have a
parent in order to actually render anything.
By the way, everything also works if a QCanvasView, whose parent is a
QWidget, is the parent of the QCanvas.
<b
More information about the PyQt
mailing list