Ask Your Question
0

How to use button with call back function?

asked 2018-12-22 03:26:36 -0600

LCY gravatar image

Hi, I want to create a button but keep having an error on call back function. When I put an event on call back function, then it shows errors.

how to write a simple call back function for button?

For example, createButton("button6",callbackButton2,NULL,CV_PUSH_BUTTON,1);

What is the "callbackButton2" means?

or how to create a simple function of button?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-12-22 04:04:30 -0600

berak gravatar image

updated 2018-12-22 04:09:43 -0600

did you build your opencv libs with Qt support ? (else it is not supported at all)

the signature of your callback function should be:

void callback(int state, void*userData) {
    // do something
}

then add it to the button:

createButton("button6",callback, NULL, CV_PUSH_BUTTON,1);
edit flag offensive delete link more

Comments

Hi, how to know my libs with Qt support or not?

LCY gravatar imageLCY ( 2019-01-05 04:36:54 -0600 )edit

what is Qt support?

LCY gravatar imageLCY ( 2019-01-05 04:42:48 -0600 )edit

do a : cout << cv::getBuildInformation() << endl;

(there's a GUI section to look at)

berak gravatar imageberak ( 2019-01-05 04:50:12 -0600 )edit

Sorry, I am a beginner. So, where to see there is a Qt support or not?

LCY gravatar imageLCY ( 2019-01-05 05:12:01 -0600 )edit

see above, again, please.

(and no you probably don't have any such thing. you would have remembered setrting it up.)

last, you should use your time to write kick-ass computer-vision algo's not waste it on gui problems. 2 years later, noone will look at your current program, promised !

berak gravatar imageberak ( 2019-01-05 05:18:05 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-12-22 03:26:36 -0600

Seen: 1,592 times

Last updated: Dec 22 '18