Hello!

Don't know if this applies to your case, but I often use the static 
method QApplication.invokeLater() to bring stuff that happens in a 
separate thread back into the main Qt thread. I avoid exceptions like 
this then.

Regards,
Helge Fredriksen

On 08/19/2010 03:38 AM, go canal wrote:
> Hello,
> New to Qt Jambi, sorry if this is already been asked before.
>
> I got an exception:
> -----------------------------------------------------------
> Exception in thread "Thread-2" QObject used from outside its own 
> thread, object=QWebPage(0x17b786e8) , 
> objectThread=Thread[main,5,main], currentThread=Thread[Thread-2,5,main]
> at 
> com.trolltech.qt.GeneratorUtilities.threadCheck(GeneratorUtilities.java:59)
> at com.trolltech.qt.webkit.QWebPage.mainFrame(QWebPage.java:619)
> at Thumbnailer.run(Thumbnailer.java:44)
> at java.lang.Thread.run(Thread.java:619)
> at com.trolltech.qt.QThread.run(QThread.java:164)
> -----------------------------------------------------------
> Could not figure out what's wrong.  Here is my code
> In the UI_Main :
> {
> ......
> button.clicked.connect(this, "thumb()");
> ......
> }
> void thumb() {
> Thumbnailer nailer = new Thumbnailer (lineEdit.text());
> QThread thread = new QThread (nailer);
> nailer.moveToThread(thread);
> thread.start();
> }
> Here is the Thumbnail class (download a web page and create a 
> thumbnail image):
> public class Thumbnailer extends QObject implements Runnable {
> ......
> @Override
> public void run() {
> page.loadFinished.connect(this, "render(Boolean)");
> page.mainFrame().load(new QUrl(url));
> }
> ......
> }
>
> What did I do wrongly ?
>
>
> many thanks,
> canal
>
>
>
> _______________________________________________
> 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

Reply via email to