Ok. I think I found it.
QApplication#invokeLater(Runnable) = Display#asyncExec
QApplication#invokeAndWait(Runnable) = Display#snyExec
Tom
Tom Schindl schrieb:
> Upps looks like we got of from the List
>
> Tom
>
> Tom Schindl schrieb:
>> Hi Gunnar,
>>
>> Looks like I don't get how this is done.
>>
>> ----------8<----------
>> final QLineEdit l = new QLineEdit()
>>
>> Thread t = new Thread() {
>> public void run() {
>> // How do I now call l.setText("Bla Bla");
>> }
>> };
>>
>> t.run();
>> ----------8<----------
>>
>> As said I'm very new to QT-Jambi and QT so maybe I've missed the obvious
>> thing. In SWT I'd write:
>>
>> ----------8<----------
>> final Text t = new Text(....);
>> Thread t = new Thread() {
>> public void run() {
>> t.getDisplay().asyncExec( new Runnable() {
>> public void run() {
>> t.setText("Bla Bla");
>> }
>> });
>> }
>> };
>>
>> t.run();
>> ----------8<----------
>>
>> Thanks for your patients.
>>
>> Tom
>>
>> Gunnar Sletta schrieb:
>>> Tom Schindl wrote:
>>>> Hi Gunnar,
>>>>
>>>> Gunnar Sletta schrieb:
>>>>> Tom Schindl wrote:
>>>>>
>>>>> Hi Tom,
>>>>>
>>>>>> b) Ask some questions:
>>>>>> - How do I sync back from a None-UI-Thread (in databinding this the
>>>>>> task of the Realm you see above)
>>>>> You sync back to main thread using either queued connections
>>>>>
>>>>> http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/qtjambi-signalsandslots.html
>>>>>
>>>>>
>>>>> http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/core/Qt.ConnectionType.html
>>>>>
>>>> From reading
>>>> http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/qtjambi-threads.html
>>>>
>>>> I looks like I can call methods (like QLineEdit#setText) from any thread
>>>> I want?
>>> This is incorrect. This is specified for instance in the "The Threading
>>> Classes" section with:
>>> "Note that QCoreApplication::exec() must always be called from the main
>>> thread (the thread that executes main()), not from a another thread. In
>>> GUI applications, the main thread is also called the GUI thread because
>>> it's the only thread that is allowed to perform GUI-related operations."
>>>
>>>
>>>
>>>>> or by posting a custom event
>>>>>
>>>>> http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/core/QCoreApplication.html#postEvent(com.trolltech.qt.core.QObject,%20com.trolltech.qt.core.QEvent)
>>>>>
>>>>>
>>>>>
>>>>>> - How do I find out which thread is the UI-Thread to know when I
>>>>>> have
>>>>>> sync back to the UI-Thread
>>>>> You can always check QApplication.instance().thread() versus
>>>>> Thread.currentThread() to see if the two are the same or not. They will
>>>>> be the same when you are executing code in the main thread.
>>>> If the above statement is appropriate I think I don't need
>>>> thread-syncing.
>>> you do. You will get threading exceptions when trying to call GUI
>>> functionality from the outside the main thread.
>>>
>>>
>>
>
> _______________________________________________
> Qt-jambi-interest mailing list
> [email protected]
> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest