1. See if you have q_object in your class declaration and inherit the public qmainwindow{
For example:
Class Cplot:public qmainwindow{
q_object
2, you declare the function to add the declaration:
Private Slots:
void xxxx ();
And you want to add the function above to the constructor, which is accessed directly by the constructor:
Public:
Cplot (Qwidget *parent = 0);
Private slots:
void OpenFile ();
void Segmentobj ();
void Capture ();
void Drawrays ();
3, check the slot function name spelling is incorrect, and the corresponding signal and slot parameters are consistent
If not, clean up the project, delete the original moc_xxx.cpp, and perform qmake again.
or modify it yourself:
For example: adding slots:
static const char qt_meta_stringdata_openglviewer[] = {
"mainviewer\0\0openfile () \0segmentobj ()"
"capture () ""
};
void Cplot::qt_static_metacall (QObject *_o, qmetaobject::call _c, int _id, void **_a)
{
if (_c = = Qmetaobject::in Vokemetamethod) {
Q_assert (Staticmetaobject.cast (_o));
Cplot *_t = Static_cast<cplot *> (_o);
Switch (_id) {case
0: _t->openfile ();
Case 1: _t->segmentobj (); break;
Case 2: _t->capture (); break;
Default:;
}
}
Q_unused (_a);
}