Reputation: 525
I created my project with OpenCV and QT libraries.
In my project, I show to my webcam a Marker (using aruco); when cam recognize it, a browser is created (with Qt library) and a site is shown. (you can see it in this image)
But, when I close the browser and i show the marker to cam again (I don't close my project), my program stops unexpectedly
I work on Win7 x64 with QtCreator 2.6.0 e qt 4.8.3 library. I think problem is the QApplication. it seems that does not close completely.
this is the code of browser's creation (QApplication's creation):
int browser(int argc, char **argv)
{
Q_INIT_RESOURCE(data);
BrowserApplication application(argc, argv);
if (!application.isTheOnlyBrowser())
return 0;
application.newMainWindow();
return application.exec();
}
Anyone have any ideas or know how to fix it???
Thanks!
Upvotes: 1
Views: 689
Reputation: 9986
It is my understanding you have one application with at least two windows (one for the camera and one for the browser) and I suspect BrowserApplication is subclassing QApplication. Is this correct? If I'm correct, then read the first few lines of the QApplication class description:
For any GUI application using Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any given time.
You're not providing the implementation of BrowserApplication but I suspect you're creating two instances.
Upvotes: 1