No Such Slot Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn object::connect: no such slot more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags connect no such slot mainwindow Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you,
Q_object Undefined Reference To Vtable
helping each other. Join them; it only takes a minute: Sign up Qt5 connect “No such slot” error up vote 12 down vote favorite 1 I checked other similar questions and tried their solutions but they don't work
Qobject::connect: No Such Slot
for me. I'm basically trying to make a http client that only makes post requests. In order to do this, I need to connect QNetworkManager's finished signal to some callback slot. Here's my code. h file: ... public slots: void finishedSlot(QNetworkReply* reply); private: QNetworkAccessManager *network_manager; ... cpp file: ... Class1::Class1(){ network_manager = new QNetworkAccessManager(this); QObject::connect(network_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(finishedSlot(QNetworkReply *))); } ... void Class1::finishedSlot(QNetworkReply* reply) { // some logic with reply } ... As you can object connect no such slot qwidget see, the slot is definitely present and it is declared under public slots in header file. So I have no idea why this is happening. I already tried clean, run qmake, and rebuild. The error message is "QObject::connect: No such slot QObject::finishedSlot(QNetworkReply *)" Any idea? c++ qt signals qt5 share|improve this question edited Mar 23 at 15:47 Angie Quijano 1,3882718 asked Nov 10 '13 at 6:13 Charlemagne 5482512 2 Notice that the error says QObject::finishedSlot. That means Qt doesn't know about your subclass. That means meta information about it wasn't generated. That means moc wasn't run on your class. That means your class is lacking the Q_OBJECT macro. –peppe Nov 10 '13 at 9:56 add a comment| 3 Answers 3 active oldest votes up vote 24 down vote accepted You probably forgot to use the Q_OBJECT macro. Every class that implements its own slots/signals needs that macro. Don't forget that you need to add your header/source file to the .pro file. share|improve this answer edited Sep 7 '15 at 17:46 answered Nov 10 '13 at 6:17 Zeta 61k698148 3 Thanks a lot. I also had to clean/qmake/rebuild after adding that. –Charlemagne Nov 10 '13 at 21:51 @Charlemagne: Merely re-running quake on the project would have sufficed, I think. This can save time on large projects. –Kuba Ober Nov 11 '13 at 22
here for a quick overview of the site Help Center Detailed answers to any questions
Qt Error Undefined Reference To Vtable For
you might have Meta Discuss the workings and policies of this q_object macro site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers qt slot or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a http://stackoverflow.com/questions/19886878/qt5-connect-no-such-slot-error community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up QT “No such slot” Error [duplicate] up vote 0 down vote favorite This question already has an answer here: When should Q_OBJECT be used? 4 answers This is the part of my Class http://stackoverflow.com/questions/31562023/qt-no-such-slot-error definition/.hpp file: class RenderGraphFrame : public QGLWidget { public: RenderGraphFrame(QWidget *parent); private slots: void PrevButton(); void NextButton(); private: void draw(); QWidget *p_parent; bool ButtonsInited; QPushButton *nextButton; QPushButton *prevButton; } And this are the related source parts: RenderGraphFrame::RenderGraphFrame(QWidget *parent) : QGLWidget(QGLFormat(/*QGL::SampleBuffers*/), parent) { p_parent = parent; /* ... */ } void RenderGraphFrame::draw() { if (ButtonsInited == false) { bool tmpttest_success; nextButton = parent->findChild
download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript). Home https://forum.qt.io/topic/23597/solved-no-such-slot-error Qt Development General and Desktop [solved] "No such slot" error [solved] "No such slot" error This topic has been deleted. Only users with topic management privileges https://bbs.archlinux.org/viewtopic.php?id=69910 can see it. bio120 last edited by Hi all. I have a problem, that I can't solve. I have class MainWindow and I have two slots no such in private slots section: @ void getData(QUrl url, QScrollArea *object); void proccessData(QNetworkReply *pReply, QScrollArea *object);@ There are source codes of this slots: @void MainWindow::getData(QUrl url, QScrollArea object) { static QNetworkAccessManager am; QNetworkRequest request(url); QNetworkReply reply = am.get(request); connect(reply,SIGNAL(finished()), this,SLOT(proccessData(reply,object))); } void MainWindow::proccessData(QNetworkReply *pReply, QScrollArea object) { QLabel label = new QLabel; label->setText(pReply->readAll()); object->setWidget(label); no such slot }@ My app compiles without any errors, but when I "getData" calls "processData", I see that in my debug window @Object::connect: No such slot MainWindow::proccessData(reply,object) in ..\MainWindow.cpp:166@ Also I have QScrollArea without any text. Please, help me Reply Quote 0 BelenMuñoz last edited by Maybe the problem is the connect inside the getData slot. You could try to put it in constructor. Hope it helps you. Regards. Me casé con un enano pa jartarme de reí. Reply Quote 0 MuldeR last edited by Your slot function is defined as @proccessData(QNetworkReply*, QScrollArea*)@ But you try to connect to, so indeed there is no such slot! @SLOT(proccessData(reply,object))@ You need to change that to: @SLOT(proccessData(QNetworkReply*, QScrollArea*))@ Also you may consider changing your function's signature to: @proccessData(const QNetworkReply &reply const QScrollArea &area)@ My OpenSource software at: http://muldersoft.com/ Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS Go visit the coop: http://youtu.be/Jay... Reply Quote 0 bio120 last edited by [quote author="BelenMuñoz" date="1359043115"]Maybe t
2009-04-14 04:08:58 tony5429 Member Registered: 2006-03-28 Posts: 910 Website [SOLVED] Simple QT Question: Connecting Widgets to Slots I'm trying to make a very simple QT application with an LCD widget that starts out at 0, but when the user clicks the button below it, the LCD changes to read "5." The code I have right now compiles just fine but when I click the button, nothing seems to happen...#include