[Kde-java] Compressed Icons in Java Apps created with juic

Lukas Molzberger Lukas.Molzberger at gmx.de
Sat Aug 21 10:30:40 CEST 2004


I guess I found the reason why the events haven't been delivered. 
ClassifierThread.FINISHED_IMPORT_CORPUS was set to value 0 and it seems that 
Qt doesn't deliver events of type 0. So basically it had nothing to do with 
QtJava. 

Cheers
Lukas

Am Mittwoch, 18. August 2004 14:04 schrieb Richard Dale:
> On Wednesday 18 August 2004 12:35, Lukas Molzberger wrote:
> > Hi,
> >
> > > Could you post the .ui file to make it easier to test out the problem?
> >
> > Sure, I'll send you the .ui file.
>
> Yes, thanks for sending me that..
>
> > In the meantime I've got yet another problem. Perhaps you know a solution
> > for that problem too. The app that I'm writing contains a few operations
> > that may take a long time to process and therefore I had to use Java
> > threads to keep the ui from blocking.
>
> Another way to break up long term operations is to use a single thread with
> QTimers - each long term operation does something for say 100 ms, then
> exits setting a QTimer again ready for another 100 ms of processing once
> the other operations have had a chance. This assumes that the work can be
> split up into discrete chunks though. Or perhaps just fork() and exec() a
> subprocess to run in the background.
>
> > So I have one thread for the ui and
> > one thread for the actual processing and I use a working queue to get the
> > commands from the ui to the processing thread. So far everything works
> > very well, but what I still need is a way to inform the ui that
> > processing has finished and that the ui needs to be updated. According to
> > the Qt docs the way to do this is to call
> >
> > QCustomEvent ce = new
> > QCustomEvent(ClassifierThread.FINISHED_IMPORT_CORPUS);
> > QApplication.postEvent( qmainwindow, ce );
> >
> > in the processing thread and to have a method
> >
> >    protected void customEvent(QCustomEvent e) {
> >      System.exit(0);  // Exit just for testing
> >    }
> >
> > as part of the QMainWindow object. The problem is that while
> > QApplication.postEvent( qmainwindow, ce ); definitely gets called, the
> > event handler customEvent however doesn't get called. Do you have any
> > idea?
>
> I'm not sure if you can mix java threads and Qt threads like this. I think
> that's more likely to be the problem than the QMainWindow.customEvent()
> method being wrong. Is there a Qt event logging mechanism that could be
> turned on to track how the custom event gets lost?
>
> In QMainWindow.cpp there is a custom event handler for overriding
> customEvent() and it looks just the same as the other event handlers:
>
>  void customEvent(QCustomEvent* arg1) {
>   if (!QtSupport::eventDelegate(this,"customEvent",
> (void*)arg1,"org.kde.qt.QCustomEvent")) {
>    QObject::customEvent(arg1);
>   }
>   return;
>  }
>
> -- Richard
> _______________________________________________
> Kde-java mailing list
> Kde-java at kde.org
> https://mail.kde.org/mailman/listinfo/kde-java


More information about the Kde-java mailing list