On Friday 23 of April 2010 08:50:33 you wrote:

Hi.

I am posting my reply to conference to return back there.

Very basically, you can't pass null as argument to initialize(). Just pass 
empty array ( it is the same situation like user didn't specified any 
parameters on commandline ). Thats what my snippet is about.

> Thanks for your answer Dusan.
>
> What I want to do is the following.
> I want to make a screenshot of a webpage using the QT framework. I use the
> integrated Webkit browser. If I use a standalone application where I am
> able to call the QApplication.initialize(args) in the main method,
> everything works fine.

> But I want to call the QApplication in a non-main method somewhere in my
> server application. (On demand when a user requests a screenshot). And I do
> not want to call an external jar file to make screenshots by using
> System.exec()

> So the intention is to initialize the QT Framework at some place outside of
> main.
>
> Is this possible at all?

I don't know anything about threads in your webapp, but you must call 
QApplication.initialize() only once in your context ( on "web application" 
initialization, in servlet constructor or in some static block of some object 
or using boolean semaphore like in my snippet ... ).

I absolutely don't know if this should work in webapp, I've never tired it and 
never hear about this case of qtjambi usage.

But back to basics, primary problem caused that stacktrace was NULL value.

Try empty String[] and tell us if you was successfull.


>
> Thanks for your code snippet, but I didn´t know how this relates to the
> problem.
>
> Thanks a lot,
> Marc
>
> -----Ursprüngliche Nachricht-----
> Von: Dusan Zatkovsky [mailto:[email protected]]
> Gesendet: Freitag, 23. April 2010 08:43
> An: [email protected]
> Betreff: Re: [Qt-jambi-interest] qtjambi - QApplication.initialize
> outsideof main method
>
> On Thursday 22 of April 2010 17:10:47 Giombetti, Marc wrote:
> > Does anyone have an idea how to initialize the QApplication outside of
> > the main method.
>
> I don't understand if it is standalone app, or you are hacking jambi to
> webapp ( is this possible? ), but try this:
>
> if ( !previouslyInitialized ) {
>       QApplication.initialize( new String[] {} );
>       previouslyInitialized = true;
> }



-- 
Dusan

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

Reply via email to