> 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 ?
Well, the problem is that you cannot call a QT Widget object outside of the 
main thread. To do what you want, you need and independent object (that 
doesn't  inherit  from some Qt widget Object) that handles the process that 
run in the thread and use some signal /slot to catch when the process finish.
> 
> many thanks,
> canal
-- 
Ing. José Arcángel Salazar Delgado
Nettrace
Av 27 #6 col. Venustiano Carranza.
Boca del río, Ver.
Tel. Oficina 9-27-54-78

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to