| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 6 | |
<<< text/html: EXCLUDED >>>
Why don't you use QWidget::setUpdatesEnabled(bool) ?
It's a way to "freeze" the current 'widget' (not 'display')
widget->setUpdatesEnabled(false);
// something that make flickers here
widget->setUpdatesEnabled(true);
Naoyuki
On 2002 March 15 Friday 10:33, David Reeves wrote:
> I have a widget that servers as a type of custom modal
> form that is programmatically populated with other
> widgets depending on user input.
>
> Frequently - I need to remove constituent widget parts
> and add new ones. Currently, the form flickers as i
> perform those operations. I need a way to "freeze" the
> current display - do my changes and the "unfreeze" the
> display.
>
> Can you recommend an approach to my problem?
>
> Thanks,
>
> David
> David N.S. Reeves
> (713) 963-9762
> dnreeves@swbell.net
I tried the setUpdatesEnabled(FALSE) before removing the constituent widget and adding a new constituent widget with a new one followed by setUpdatesEnabled(TRUE); - and I still see the same flicker. I even set the parent window and the main window to setUpdatesEnabled(FALSE) - and it still flickers - I even removed the setUpdatesEnabled(TRUE); - and screen appears to work exactly the same as it did prior to any setUpdatesEnabled() functions were added. Are you sure that it works for removing widgets with delete? I'm using Qt 3.01 commercial. Could it be a bug? David ----- Original Message ----- From: "IKEGAMI Naoyuki" <nikeg@d5.dion.ne.jp> To: <qt-interest@trolltech.com> Sent: Friday, March 15, 2002 4:53 AM Subject: Re: How to redice flicker when changing a widget > Why don't you use QWidget::setUpdatesEnabled(bool) ? > It's a way to "freeze" the current 'widget' (not 'display') > > widget->setUpdatesEnabled(false); > // something that make flickers here > widget->setUpdatesEnabled(true); > > Naoyuki > > > On 2002 March 15 Friday 10:33, David Reeves wrote: > > I have a widget that servers as a type of custom modal > > form that is programmatically populated with other > > widgets depending on user input. > > > > Frequently - I need to remove constituent widget parts > > and add new ones. Currently, the form flickers as i > > perform those operations. I need a way to "freeze" the > > current display - do my changes and the "unfreeze" the > > display. > > > > Can you recommend an approach to my problem? > > > > Thanks, > > > > David > > David N.S. Reeves > > (713) 963-9762 > > dnreeves@swbell.net > > -- > List archive and information: http://qt-interest.trolltech.com >
If you delete the widget, you could give a try at QWidgetStack and have multiple layers of widgets to delete and make a kind of Z-buffer with that... just my 2 cents. Good luck. ----- Original Message ----- From: "David Reeves" <dnreeves@swbell.net> To: <nikeg@d5.dion.ne.jp>; <qt-interest@trolltech.com> Sent: Friday, March 15, 2002 2:29 PM Subject: Re: How to redice flicker when changing a widget > I tried the setUpdatesEnabled(FALSE) before removing the constituent widget > and adding a new constituent widget with a new one followed by > setUpdatesEnabled(TRUE); - and I still see the same flicker. > > I even set the parent window and the main window to > setUpdatesEnabled(FALSE) - and it still flickers - > > I even removed the setUpdatesEnabled(TRUE); - and screen appears to work > exactly the same as it did prior to any setUpdatesEnabled() functions were > added. > > Are you sure that it works for removing widgets with delete? > > I'm using Qt 3.01 commercial. Could it be a bug? > > David > ----- Original Message ----- > From: "IKEGAMI Naoyuki" <nikeg@d5.dion.ne.jp> > To: <qt-interest@trolltech.com> > Sent: Friday, March 15, 2002 4:53 AM > Subject: Re: How to redice flicker when changing a widget > > > > Why don't you use QWidget::setUpdatesEnabled(bool) ? > > It's a way to "freeze" the current 'widget' (not 'display') > > > > widget->setUpdatesEnabled(false); > > // something that make flickers here > > widget->setUpdatesEnabled(true); > > > > Naoyuki > > > > > > On 2002 March 15 Friday 10:33, David Reeves wrote: > > > I have a widget that servers as a type of custom modal > > > form that is programmatically populated with other > > > widgets depending on user input. > > > > > > Frequently - I need to remove constituent widget parts > > > and add new ones. Currently, the form flickers as i > > > perform those operations. I need a way to "freeze" the > > > current display - do my changes and the "unfreeze" the > > > display. > > > > > > Can you recommend an approach to my problem? > > > > > > Thanks, > > > > > > David > > > David N.S. Reeves > > > (713) 963-9762 > > > dnreeves@swbell.net > > > > -- > > List archive and information: http://qt-interest.trolltech.com > > > > -- > List archive and information: http://qt-interest.trolltech.com >
Calling setUpdatesEnabled(true) inhibits repainting to same region many times in short duration by blocking paint events. They are not canceled, but only delayed. Calling setUpdatesEnabled(false) evokes delayed repainting to invalidated region. Usually draw-at-once is less flicking than draw-in-situ, so it is effecttive in many cases, but may be still flickers. If you want your widget flickers-clean completely, QPainter::redirect(), QPixmap::grabWidget() may be your help. Calling QPainter::redirect(widget, pixmap) really inhibits repainting to the widget, calling QPixmap::grabWidget(widget) let the widget draw itself on an offscreen buffer. On 2002 March 16 Saturday 04:29, David Reeves wrote: > I tried the setUpdatesEnabled(FALSE) before removing the > constituent widget and adding a new constituent widget > with a new one followed by setUpdatesEnabled(TRUE); - and > I still see the same flicker. > > I even set the parent window and the main window to > setUpdatesEnabled(FALSE) - and it still flickers - > > I even removed the setUpdatesEnabled(TRUE); - and screen > appears to work exactly the same as it did prior to any > setUpdatesEnabled() functions were added. > > Are you sure that it works for removing widgets with > delete? > > I'm using Qt 3.01 commercial. Could it be a bug? > > David > ----- Original Message ----- > From: "IKEGAMI Naoyuki" <nikeg@d5.dion.ne.jp> > To: <qt-interest@trolltech.com> > Sent: Friday, March 15, 2002 4:53 AM > Subject: Re: How to redice flicker when changing a widget > > > Why don't you use QWidget::setUpdatesEnabled(bool) ? > > It's a way to "freeze" the current 'widget' (not > > 'display') > > > > widget->setUpdatesEnabled(false); > > // something that make flickers here > > widget->setUpdatesEnabled(true); > > > > Naoyuki > > > > On 2002 March 15 Friday 10:33, David Reeves wrote: > > > I have a widget that servers as a type of custom > > > modal form that is programmatically populated with > > > other widgets depending on user input. > > > > > > Frequently - I need to remove constituent widget > > > parts and add new ones. Currently, the form > > > flickers as i perform those operations. I need a way > > > to "freeze" the current display - do my changes and > > > the "unfreeze" the display. > > > > > > Can you recommend an approach to my problem? > > > > > > Thanks, > > > > > > David > > > David N.S. Reeves > > > (713) 963-9762 > > > dnreeves@swbell.net > > > > -- > > List archive and information: > > http://qt-interest.trolltech.com
I appreciate your enlightenment regarding the setUpdatesEnabled() functionality (or lack of it). It is my opinion that setUpdatesEnabled(FALSE) - should function to really disable screen updates and setUpdatesEnabled(TRUE) should be required to re-enable updates. Otherwise the setUpdatesEnabled() method should be renamed setUpdatesEnabledMaybeAlittle(). Ineed something more definite. The other methods you allude to may help. Can you provide an example of the QPainter::redirect(), QPixmap::grabWidget() method to solve the general "freeze widget image while widget modifications are made" problem? Thanks for your help, David ----- Original Message ----- From: "IKEGAMI Naoyuki" <nikeg@d5.dion.ne.jp> To: "David Reeves" <dnreeves@swbell.net>; <qt-interest@trolltech.com> Sent: Saturday, March 16, 2002 12:43 AM Subject: Re: How to redice flicker when changing a widget > Calling setUpdatesEnabled(true) inhibits repainting to same > region many times in short duration by blocking paint > events. They are not canceled, but only delayed. Calling > setUpdatesEnabled(false) evokes delayed repainting to > invalidated region. Usually draw-at-once is less flicking > than draw-in-situ, so it is effecttive in many cases, but > may be still flickers. > > If you want your widget flickers-clean completely, > QPainter::redirect(), QPixmap::grabWidget() may be your > help. Calling QPainter::redirect(widget, pixmap) really > inhibits repainting to the widget, calling > QPixmap::grabWidget(widget) let the widget draw itself on > an offscreen buffer. > > > > On 2002 March 16 Saturday 04:29, David Reeves wrote: > > I tried the setUpdatesEnabled(FALSE) before removing the > > constituent widget and adding a new constituent widget > > with a new one followed by setUpdatesEnabled(TRUE); - and > > I still see the same flicker. > > > > I even set the parent window and the main window to > > setUpdatesEnabled(FALSE) - and it still flickers - > > > > I even removed the setUpdatesEnabled(TRUE); - and screen > > appears to work exactly the same as it did prior to any > > setUpdatesEnabled() functions were added. > > > > Are you sure that it works for removing widgets with > > delete? > > > > I'm using Qt 3.01 commercial. Could it be a bug? > > > > David > > ----- Original Message ----- > > From: "IKEGAMI Naoyuki" <nikeg@d5.dion.ne.jp> > > To: <qt-interest@trolltech.com> > > Sent: Friday, March 15, 2002 4:53 AM > > Subject: Re: How to redice flicker when changing a widget > > > > > Why don't you use QWidget::setUpdatesEnabled(bool) ? > > > It's a way to "freeze" the current 'widget' (not > > > 'display') > > > > > > widget->setUpdatesEnabled(false); > > > // something that make flickers here > > > widget->setUpdatesEnabled(true); > > > > > > Naoyuki > > > > > > On 2002 March 15 Friday 10:33, David Reeves wrote: > > > > I have a widget that servers as a type of custom > > > > modal form that is programmatically populated with > > > > other widgets depending on user input. > > > > > > > > Frequently - I need to remove constituent widget > > > > parts and add new ones. Currently, the form > > > > flickers as i perform those operations. I need a way > > > > to "freeze" the current display - do my changes and > > > > the "unfreeze" the display. > > > > > > > > Can you recommend an approach to my problem? > > > > > > > > Thanks, > > > > > > > > David > > > > David N.S. Reeves > > > > (713) 963-9762 > > > > dnreeves@swbell.net > > > > > > -- > > > List archive and information: > > > http://qt-interest.trolltech.com > > -- > List archive and information: http://qt-interest.trolltech.com >
I tried to write a sample, in that code I copy a widget image to another, hide original/show copy, redirect/cash new image to offscreen and swap original/copy again. By installing an event filter to original, first paint event is sent to helper class, which draws widget image with cashed data. Drawing with cashed data is fished faster than direct drawing. but it is still flicker. As far as one writes codes on abstract layers (Qt > WindowManager > X and so on), it would be almost impossible to obtain a perfect flickers-clean widget, without direct access to hardwares by low level libraries such as Direct* I can mail to you my trial. I hope you can find a more practical solution. (I tried to send to your address <dnreeves@swbell.net>, but could not. Please let me know how to) (code is for Qt-2.3.1 on linux; I don't have a compiler for Windows, sorry) On 2002 March 16 Saturday 23:36, David Reeves wrote: > I appreciate your enlightenment regarding the > setUpdatesEnabled() functionality (or lack of it). It > is my opinion that setUpdatesEnabled(FALSE) - should > function to really disable screen updates and > setUpdatesEnabled(TRUE) should be required to re-enable > updates. Otherwise the setUpdatesEnabled() method should > be renamed setUpdatesEnabledMaybeAlittle(). Ineed > something more definite. The other methods you allude > to may help. > > Can you provide an example of the QPainter::redirect(), > QPixmap::grabWidget() method to solve the general > "freeze widget image while widget modifications are made" > problem? > > Thanks for your help, > > David