Object::connect:no such slot (loss of QT slot)

Source: Internet
Author: User

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);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.