[Kde-perl] a little question

Germain Garand germain at ebooksfrance.org
Thu Jan 8 09:30:28 CET 2004


Le Jeudi 08 Janvier 2004 00:03, Rob a écrit :
> On Wednesday 07 January 2004 18:36, Germain Garand wrote:
>
> I don't think he wants anything to happen in the background here,
> I think he just wants to know how to force a repaint of his
> textedit control before executing that wget. ;) 

yes, it's more a FAQ entry than a specific answer.
But it _contains_ the precise answer nevertheless :-)

> Would something
> like select(undef, undef, undef, 0.1) (sleep 0.1 seconds) cause
> the Qt event loop to do its stuff or is there maybe some way to
> force a redraw?

Aside from processEvents(), which is enough if the update has already been 
queued (all methods modifying a visible widget property do that),
you can call QWidget::repaint() for an immediate redraw of an entire widget.
 
One can also craft a QPaintEvent, and use QApplication::sendEvent() to 
dispatch it immediately (gives much better control over the region being 
repainted).

 Issuing a  sleep would'nt do any good as the event loop does *not* run in a 
separate thread.

>
> Admittedly, I would want to do what you suggest in the case of
> downloading an ISO since you kinda need a progress meter for
> something that large.

I'd say every monolithic action that makes a GUI freeze for more than 1 second 
is worth investigating for an asynchronous/sliced alternative. At least for a 
program targetting a general audience, where it is often perceived as a bug.
It's not necessarily harder to code anyway.

Qt::GlobalSpace::qInitNetworkProtocols();
$o = Qt::UrlOperator;
$o->copy( "ftp://foo.org/big.iso", "file:/home/joe");


>
> Rob



More information about the Kde-perl mailing list