Qt-interest Archive, July 2007
QCustomEvent........
Message 1 in thread
hi,
I am posting event from no-gui thread to gui thread like the follwing...
puts("Posting event.............");
imgName="/root/a.jpg";
QCustomEvent *ce=new QCustomEvent(10000);
QApplication::postEvent(fm,ce);
puts("Posting event After.............");
and my slot is
void mainForm::customEvent( QCustomEvent *e )
{
if( e->type() == 10000 )
{
puts("*****************88IN CUSTOM EVENT****************");
puts(imgName);
fm->setPaletteBackgroundPixmap(QPixmap(imgName));
}
}
now in non-gui thread i need to excute statement, puts("Posting event
After............."); after event completed.
but now, this statement comes before puts("*****************88IN CUSTOM
EVENT****************");
Just this is a example, i mean , need to do some operation after event
completed......
Can anybody tell me plz how to do this???? How much time it takes to come in
customEvent slot, when u post some event????
Thanks and regards,
Niranjan
--
[ signature omitted ]
Message 2 in thread
postevent enqueues the event and returns immediately, so if you don't want to
sendEvent()
i guess you want to make your event emit a signal and bind it to a slot on
need
OR see:
QCoreApplication::sendPostedEvents()
QCoreApplication::flush()
QCoreApplication::processEvents()
...but there's few fun in manipulating the event queue :(
Thomas
Am Samstag, 28. Juli 2007 12:06 schrieb Niranjan:
> hi,
>
> I am posting event from no-gui thread to gui thread like the follwing...
>
> puts("Posting event.............");
> imgName="/root/a.jpg";
> QCustomEvent *ce=new QCustomEvent(10000);
> QApplication::postEvent(fm,ce);
> puts("Posting event After.............");
>
>
>
> and my slot is
>
> void mainForm::customEvent( QCustomEvent *e )
> {
> if( e->type() == 10000 )
> {
>
>
> puts("*****************88IN CUSTOM EVENT****************");
> puts(imgName);
> fm->setPaletteBackgroundPixmap(QPixmap(imgName));
>
> }
>
> }
>
>
> now in non-gui thread i need to excute statement, puts("Posting event
> After............."); after event completed.
> but now, this statement comes before puts("*****************88IN CUSTOM
> EVENT****************");
>
>
> Just this is a example, i mean , need to do some operation after event
> completed......
>
>
> Can anybody tell me plz how to do this???? How much time it takes to come
> in customEvent slot, when u post some event????
>
>
> Thanks and regards,
> Niranjan
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]