find-object icon indicating copy to clipboard operation
find-object copied to clipboard

Launch action when object is detected

Open energabos opened this issue 9 years ago • 3 comments

Hello, great app!

I've been adding message boxes and recently a blinking LED when the object is detected. Everything works great when GUI mode is on, but when using --console my actions seem to be ignored?

Where can I insert my action so it would not be ignored in console mode?

Edit : I can't get autoScreenshot to work either in console mode

energabos avatar Mar 29 '17 19:03 energabos

Hi,

In console mode, you may connect to FindObject::objectsFound() signal. For example here, we could connect the signal to a custom slot:

find_object::FindObject * findObject = new find_object::FindObject(guiMode || imagesSaved);
QObject::connect(findObject, SIGNAL(objectsFound(const find_object::DetectionInfo &)), myHandler, SLOT(blinkLED(const find_object::DetectionInfo &)));

Note that in console mode, a QCoreApplication is created instead of a QApplication. If you want to show QMessageBox, you would have to replace QCoreApplication by QApplication here.

To add custom code for console mode inside the code, this should be done in FindObject class, as MainWindow class is not used in console mode.

cheers, Mathieu

matlabbe avatar Mar 31 '17 18:03 matlabbe

Awesome app!

Im not a good coder.. Any hints to add MP3 sound played when the object is detected?

Thanks in advance!

alxbouchard avatar Jun 08 '18 21:06 alxbouchard

Well, with Qt 5 it seems possible to play a MP3: http://doc.qt.io/qt-5/audiooverview.html

matlabbe avatar Jul 04 '18 19:07 matlabbe