c++ - Connecting Leap And QT Togther -


after long long search on internet did not found reason able solution problem that:

i have application record user finger movement on demand, (when user pressing r start record when user press s stop record,

till application on console worked leap motion, have decided move application gui based application, , have chosen qt platform, integrated gui our solution , have placed 2 push buttons replace key pressing , , connected events. real problem started when wanted see captured onframe call of leap listener , have noticed ever since main gui of qt preformed callbacks of leap how blocked or dont cpu time(i dont know real issue) , tried several solutions using wrapper class inherit qobject , start thread there doesnt seem effect anything.

here main.cpp

  int main(int argc, char *argv[]) {     qapplication a(argc, argv);     mainwindow w;     leapclass::qleaplis * smp = leapclass::qleaplis::get_instance();      qthread * th =  smp->thread();     //smp->movetothread(th);     th->start(qthread::highpriority);       w.show();      return a.exec(); } 

here qleaplis wrapper class, has run method start device, still noting happens, close give on qt.

if knows how connect 2 grateful

many thanks.

the code below demonstrates how should use listener api correctly qt.

this code not require run through moc. i've checked builds , runs leap sdk.

#include <qapplication> #include <qlabel> #include "leap.h"  class mylistener : public qobject, public leap::listener { public:    virtual void onframe(const leap::controller & ctl) {       leap::frame f = ctl.frame();       // hack avoid having declare signal ,       // use moc generated code.       setobjectname(qstring::number(f.id()));       // emits objectnamechanged(qstring)    } };  int main(int argc, char *argv[]) {    qapplication a(argc, argv);    mylistener listener;    leap::controller controller;    controller.addlistener(listener);     qlabel framelabel;    framelabel.setminimumsize(200, 50);    framelabel.show();    framelabel.connect(&listener, signal(objectnamechanged(qstring)),                       slot(settext(qstring)));     int rc = a.exec();    controller.removelistener(listener);    return rc; } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -