[Qt-interest] Problem with QtextCursor and Selecting Text

Soumen Banerjee soumen08 at gmail.com
Wed Dec 22 13:32:38 CET 2010


Hi,
When I said that the slot was being called for every word event, I
thought that would happen. If you tell me that it isnt synchronized,
Im guessing that could very much be the case, since often I see the
highlighter skip a word in the middle.
Is there any way I can achieve such synchronization between threads? I
cant do the speaking in the main thread because that would lock up the
GUI.
Regards,
Soumen

On Wed, Dec 22, 2010 at 1:43 PM, Girish Ramakrishnan
<girish at forwardbias.in> wrote:
> Hi,
> Signal-slot connections across threads are achieved using normal event
> passing. In other words, firing of a signal in one thread is not
> synchronized with the slot invocation in the other thread. This is
> probably the reason why you are seeing it go out of sync.
>
> That said, if you see that highlight_text being called for 'every'
> word event immediately, where is the question of losing sync? Maybe
> you should check when exactly it goes out of sync by seeing it read
> the entire document.
>
> Girish
>
> On Tue, Dec 21, 2010 at 8:08 PM, Soumen Banerjee <soumen08 at gmail.com> wrote:
>> Hi,
>> Yes, the espeak events are generated in another thread. Also, every
>> time a word event is seen, highlight_next() is called (due to the
>> connection). If it is counting the words correctly, I cant see why it
>> is losing sync with the reading.
>> Regards,
>> Soumen
>>
>> On Tue, Dec 21, 2010 at 2:08 PM, Girish Ramakrishnan
>> <girish at forwardbias.in> wrote:
>>> Hi,
>>>
>>> On Tue, Dec 21, 2010 at 11:57 AM, Soumen Banerjee <soumen08 at gmail.com> wrote:
>>> 8< snip
>>>
>>>> Now, as I use the app, the selection begins to lag behind the text
>>>> actually being read. Ive tried making a counter to see if espeak is
>>>> generating the word events correctly. The final wordcount does match
>>>> the number of words in the text. I cant understand the reason for this
>>>> lag.
>>>
>>> How do you synchronize the word events generated by espeak and the UI?
>>> Are espeak events generated in a non-UI thread?
>>>
>>> Girish
>>>
>>
>



More information about the Qt-interest-old mailing list