[Kde-bindings] Ruby Qt4 + net/http operations

Richard Dale rdale at foton.es
Wed Oct 1 16:17:37 UTC 2008


On Wednesday 01 October 2008 15:43:06 Ruben Fonseca wrote:
> On Wed, 2008-10-01 at 13:37 +0100, Richard Dale wrote:
> > On Wednesday 01 October 2008 09:51:21 Ruben Fonseca wrote:
> > > but the thread seems to freeze somehow during the network operation
> > > (weird..)
> > >
> > > the other think I've tried was to add the operation to a
> > > QTimer.singleShot block. However, while the code is running, the entire
> > > GUI is frozen (which I think makes sense).
> > >
> > > Is it possible to do this kind of stuff with the current Qt4 Ruby
> > > bindings?
> >
> > Yes, but you need to use the Qt networking classes like Qt::Http and
> > Qt::SocketNotifier which are integrated with the Qt event loop. They are
> > no harder to use than the Ruby Net/Http ones, and I would just convert
> > your calls.
>
> So I guess it means I have to port every single library I use to the
> Qt:: API library? :-(
Ah ok - I was assuming it was all in your application code. I'm afraid you 
would have the same problem with other UI tool kits too. So you can either 
use the Qt::Timer trick to periodically let a Ruby thread run, or maybe run 
the http stuff in another process using popen() and send the output back to 
the process over the pipe.

> What's currently holding QThread to be ported to Ruby/Qt4 ?
>
> Ruben





More information about the Kde-bindings mailing list