[Kde-bindings] qtruby: Qt::TextView issue?

Germain Garand germain at ebooksfrance.org
Tue Sep 21 09:40:02 UTC 2004


Le Mardi 21 Septembre 2004 04:12, Arash Abedinzadeh a écrit :
> Hi,
>
> I noticed a weird behavior of qtruby and Qt::TextView respectively. I wrote
> a small script (attached), which starts a connection to an IRC server,
> reads everything that comes into the socket and adds the received strings
> to the Qt::TextView object. The problem is that somehow the widget needs
> some kind of signal, like a resize event, a mouseclick or something like
> that to draw the new strings.
>
> But actually I'm not even sure whether it's a qtruby issue or if messed up
> something in my code. Could someone please take a look at it? Thanks.
>

You are setting a widget property from another thread => you can't do that. 
Qt's QObject derived classes aren't thread safe.
Rather: hold your text in some place accessible to the GUI thread, then send a 
custom event to your widget using QApplication::postEvent() to notify it that 
more text is available.

Cf. Qt documentation => Thread Support in Qt

Greetings,
Germain



More information about the Kde-bindings mailing list