[Interest] How to start object in the thread?

igor.mironchik at gmail.com igor.mironchik at gmail.com
Mon Jun 9 00:10:33 CEST 2014


Thanks guys for your replies.

I've found the problem. The problem was in Object's event() method...

But now I have another problem.

In my test app I have custom event that I post with 
QCoreApplication::postEvent().

All seems ok, events posted and received but with another type that I 
expect.

static const int changeColorEventType = QEvent::registerEventType();

class ChangeColorEvent
    :    public QEvent
{
public:
    ChangeColorEvent()
      :    QEvent( static_cast< QEvent::Type >( changeColorEventType ) )
   {
   }
};

Is this code right?

In my Object's event() I receive events with type 65533 when 
changeColorEventType is 65535...

-----Original Message----- 
From: Thiago Macieira
Sent: Sunday, June 08, 2014 7:28 PM
To: interest at qt-project.org
Subject: Re: [Interest] How to start object in the thread?

Em dom 08 jun 2014, às 12:42:39, igor.mironchik at gmail.com escreveu:
> I’ve added Launcher that works on the main thread. His job is just emit
> start() signal. My Object on the different thread connects to this start()
> signal.
>
> Now Launcher emits start() signal. All is ok. But Object doesn’t receive
> it... Why?

Check that:
a) the signal was really emitted
b) the receiver was not deleted
c) the connection was successful (your earlier code had SLOT(start()), not a
   signal)
d) the event loop is running on the target thread
e) there are no warnings printed to stderr or standard debug

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest 




More information about the Interest mailing list