Re: [Qt-jambi-interest] showing a task progress - best way

2009-10-01 Thread Dusan Zatkovsky
On Wednesday 30 of September 2009 16:10:35 Aekold Helbrass wrote: I must honestly say, that I absolutely misunderstood this :) > On Wed, Sep 30, 2009 at 4:52 PM, Dusan Zatkovsky wrote: > > On Wednesday 30 of September 2009 15:43:13 Dusan Zatkovsky wrote: > > > > Maybe, what about following idea

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Gunnar Sletta
Dusan Zatkovsky wrote: > Hi all. > I have a question about how to show some task progress. Here is my story: > I needed to create a "task", that runs a long-time job ( simulated by cycle > over sleep()s in example code ) and shows the progress. > I have tried 2 ways to do this, but none is the bes

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Aekold Helbrass
Oh, and don't forget to assign value to private ValueHolder valueHolder before first run, or you'll get NullPointerException. On Wed, Sep 30, 2009 at 5:10 PM, Aekold Helbrass wrote: > On Wed, Sep 30, 2009 at 4:52 PM, Dusan Zatkovsky wrote: >> On Wednesday 30 of September 2009 15:43:13 Dusan Zatk

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Aekold Helbrass
On Wed, Sep 30, 2009 at 4:52 PM, Dusan Zatkovsky wrote: > On Wednesday 30 of September 2009 15:43:13 Dusan Zatkovsky wrote: > > Maybe, what about following idea - start a thread with will repeatelly call > QApplication.processEvents() in acceptable interval? Then I should do my job > in main threa

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Dusan Zatkovsky
On Wednesday 30 of September 2009 15:52:03 Dusan Zatkovsky wrote: > Maybe, what about following idea - start a thread with will repeatelly call > QApplication.processEvents() in acceptable interval? Then I should do my > job in main thread, show messageboxes etc... It doesn't work :( :). But than

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Dusan Zatkovsky
On Wednesday 30 of September 2009 15:43:13 Dusan Zatkovsky wrote: Maybe, what about following idea - start a thread with will repeatelly call QApplication.processEvents() in acceptable interval? Then I should do my job in main thread, show messageboxes etc... What do you think? > > You can d

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Dusan Zatkovsky
On Wednesday 30 of September 2009 15:27:32 Aekold Helbrass wrote: > You can do it like this: > QApplication.invokeLater(new Runnable() { > > public void run() { > // construct and show message box here > } > > }); > > It w

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Aekold Helbrass
You can do it like this: QApplication.invokeLater(new Runnable() { public void run() { // construct and show message box here } }); It worked when I checked it last time. The only thing - I am not sure how to return answ

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Dusan Zatkovsky
> Oh, no, not like that :) I asked about sigProgressChanged.emit(i); > operation, it invokes UI-related method outside event loop. But if it > works - it's great. Ok, and what to do with that messagebox? I need to ask a question within job thread and receive user answer. -- Dusan __

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Aekold Helbrass
On Wed, Sep 30, 2009 at 2:05 PM, Dusan Zatkovsky wrote: > Hi, > >> Are you sure code from first way will work? > > Yes. It was simplified a bit, but copy-pasted from running project. > > I have tried to change it to: > >        Job j = new Job(); >        j.sigProgressChanged.connect(b, "setValue(

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Dusan Zatkovsky
Hi, > Are you sure code from first way will work? Yes. It was simplified a bit, but copy-pasted from running project. I have tried to change it to: Job j = new Job(); j.sigProgressChanged.connect(b, "setValue(int)"); QApplication.invokeLater(j); d.exec(); but gu

Re: [Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Aekold Helbrass
Are you sure code from first way will work? I thought QApplication.invokeLater was made to submit UI changes into Qt UI event loop... I may be wrong though. It depends on what for do you need it. Of course first is closer to perfect if you're ready to support that code. Did you looked at SwingWork

[Qt-jambi-interest] showing a task progress - best way

2009-09-30 Thread Dusan Zatkovsky
Hi all. I have a question about how to show some task progress. Here is my story: I needed to create a "task", that runs a long-time job ( simulated by cycle over sleep()s in example code ) and shows the progress. I have tried 2 ways to do this, but none is the best. I'll be happy if someone t