From kde-devel Mon Dec 30 07:07:18 2002 From: Pablo de Vicente Date: Mon, 30 Dec 2002 07:07:18 +0000 To: kde-devel Subject: Re: How to update a QPainted qwidget? X-MARC-Message: https://marc.info/?l=kde-devel&m=104123209730945 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 El Sáb 28 Dic 2002 17:54, Arnold Krille escribió: > On Saturday 28 December 2002 08:21, Pablo de Vicente wrote: > > I am writing some code in which I use QPainter to draw some axis and > > curves on a qwidget. Now I have two basic problems: > > - When the axis change I try to redraw them calling update(). When doing > > this instead of erasing the previous content of the widget and drawing > > the new axis I only append the new ones. I have tried with repaint(true), > > and I have also used erase() before calling update() or repaint(). But > > none of this works. > > Paint your widget with the backgroundcolor first. > > > - if I raise a window in front of the widget where I have the curves and > > then move the window to another place so that my widget is not covered by > > anything the content of the qwidget disappears. That is I loose the axis > > and curves I had previously drawn. > > Do you use paintEvent()? > It should redraw you widget if the covering goes away... > > Arnold I found the probem. The problem was that paintEvent was defined for the parent widget and it did not automatically repaint the child widgets. So I changed the design of the code and I created a new object which inherits QWigdet so that I can now define paintEvent only for that widget (which originally was a child). I was not interested in repainting the original parent widget. thanks, Pablo -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) iD8DBQE+D/CmSItUpHl6kJERAm+NAJ90rAAtpbG+PBxO0NBfMl5wq8etuACeKX59 L24bMt5pdwXNewmBc9pfOU8= =JbZC -----END PGP SIGNATURE----- >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<