I am working with C++, QT 5.11.3, Visual Studio 2015 and QGIS 3.7

I'm trying to develop QT c++ application that uses the qgis api. I want to display simple raster and vector map in my qt application. I create QgsVectorLayer and QgsRasterLayer that added to the QgsProject instance and then QgsMapCanvas object. That is no problem so far.

But when i turn the visible property of QgsMapCanvas object, the application crash. The error message and the crash window is above.

QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread ... Reciever (of type 'QGSMapCanvas') ...

enter image description here

I try to this process at different qt thread or main thread no matter what, does not help.
What can i do wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.