No Such Slot Error Qt
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
Object::connect: No Such Slot
more about Stack Overflow the company Business Learn more about hiring developers or posting connect no such slot mainwindow ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack
Q_object Undefined Reference To Vtable
Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Qt connect “no such slot” when slot definitely does exist up qobject::connect: no such slot vote 4 down vote favorite Qt v4.8.0, VC2010 compiler I have a QMainWindow based class and I'm trying to send it signals involving QUuid However, every time I run it I get the errors: Object::connect: No such slot MainWindow::on_comp_connected(QUuid) in ..\..\src\mainwindow.cpp:143 Object::connect: (receiver name: 'MainWindow') It's driving me potty as the slot definitely does exist (it's in the moc_) class MainWindow : public QMainWindow { Q_OBJECT // SNIP object connect no such slot qwidget private typedefs public: MainWindow(QWidget *parent = 0, Qt::WFlags flags = 0); ~MainWindow(); // SNIP public methods signals: void testSendQuuid(const QUuid &qcid); public slots: void on_comp_connected(const QUuid &qcid); private: // SNIP private parts QOpenAcnController *acnInt; // This is where the signal comes from }; At the end of the MainWindow constructor (the line 143 mentioned) I have: connect(acnInt, SIGNAL(callback_comp_connected(QUuid)), this, SLOT(on_comp_connected(QUuid))); Given that the slot is definitely there in the moc_mainwindow.cpp (I checked, it's slot #1), what on earth could be stopping the connection happening? If I try to connect the testSendQuuid(QUuid) signal to the slot, I get no such signal and no such slot as well. I cannot for the life of me figure out why Qt is denying the existence of a slot that is most definitely there! qt signals-slots share|improve this question asked May 18 '12 at 16:38 Richard1403832 110116 Did you already try a clean, Run qmake, build sequence? Sometimes the Qt-generated make file gets confused. –Dave Mateer May 18 '12 at 17:09 Yes indeed, first thing I tried! I've had a few occasions where qmake or moc got confused (usually when promoting a class to a QObject descendent when it previously was not). In this cas
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
Undefined Reference To Vtable Qt
the company Business Learn more about hiring developers or posting ads with us Stack q_object macro Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of
Qt Slot
6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up QT: No Such Slot up vote 4 down vote favorite 1 Problem is that I keep getting the http://stackoverflow.com/questions/10656510/qt-connect-no-such-slot-when-slot-definitely-does-exist 'No Such Slot' runtime error in Qt Creator every time I launch a 'settings' window from my main window. I've found Qt to be quite counter-intuitive so far and this slots 'n signals concept seems a bit of a stretch from simply passing vars or function calls. Basically, I have menu with a settings option, that when clicked, opens a settings window which needs to grab a double from the user and http://stackoverflow.com/questions/6735486/qt-no-such-slot update a var in the main window. SettingsWindow.h class SettingsWindow : public QWidget { Q_OBJECT public: SettingsWindow(QWidget *parent = 0); signals: void ValChanged(double newVal); public slots: void Accept(); private: QLineEdit *le1; }; The settings window has an accept button which calls Accept() which emits the ValChanged signal with newVal set as the user input in le1 as a double. SettingsWindow.cpp void SettingsWindow::Accept(){ emit ValChanged(le1->text().toDouble()); this->close(); } This settings window is called by the application's main window: MainWindow MainWindow.cpp class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0); public slots: void SetVal(double x); private slots: void NewWindow(); private: double theVal; }; This main window has a menu which one would select settings from. This creates a new window with a field for one to enter a number. MainWindow.cpp void MainWindow::NewWindow() { SettingsWindow *MySettings=new SettingsWindow(this); QObject::connect(MySettings, SIGNAL(ValChanged(double)), this, SLOT(SetVal(double))); MySettings->show(); MySettings->raise(); } void MainWindow::SetVal(double x){ theVal = x; } My hope is that when the settings window is opened, the user can enter a val into the field which then emits the ValChanged Signal which sets theVal to the value specified by the user. Most of the time I saw an issue with people not including Q_OBJECT macro, but I've included it both times. Any suggestions on why this doesn't work? qt user-interfac
download a browser that supports JavaScript, or enable it if it's disabled (i.e. https://forum.qt.io/topic/23597/solved-no-such-slot-error NoScript). Home Qt Development General and Desktop [solved] "No such http://www.qtforum.org/article/3201/runtime-error-from-qt-no-such-slot.html slot" error [solved] "No such slot" error This topic has been deleted. Only users with topic management privileges can see it. bio120 last edited by Hi all. I have a problem, that I can't solve. I have class MainWindow and I no such have two slots 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 no such slot label = new QLabel; label->setText(pReply->readAll()); object->setWidget(label); }@ 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:
QtForum.org » Qt » Qt Programming » Runtime Error from QT: "No such slot" Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here. Skip user information Demoncleaner Beginner Posts: 8 1 Monday, September 20th 2004, 10:20am Runtime Error from QT: "No such slot" Hi,these are my first attempts to get familar with qt: Source code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 class Test : public QObject{ private: int i; public: Test():QObject(), i(0){} void slotPrint(){ cout << "This is the timer after the " << i << ". run!" << endl;i++;} }; int main(int argc, char **argv){ Test *t = new Test(); QTimer *timer = new QTimer(); t->connect(timer,SIGNAL(timeout()), t, SLOT(slotPrint())); timer->start(199, FALSE); return 1; } This simple code fragment gives me the following error: Source code 1 2 3 4 5 skreyer@taco31:~> g++ -I /usr/lib/qt3/include/ -L /usr/lib/qt3/lib/ -lqui versuch.cpp skreyer@taco31:~> ./a.out QObject::connect: No such slot QObject::slotPrint() QObject::connect: (sender name: 'unnamed') QObject::connect: (receiver name: 'unnamed') Any suggestions? Thanks Steve This post has been edited 1 times, last edit by "Demoncleaner" (Sep 20th 2004, 10:21am) Go to the top of the page Skip user information ZX_SA Trainee Posts: 90 Location: Stellenbosch, South Africa Occupation: Software Engineer 2 Monday, September 20th 2004, 10:28am RE: Runtime Error from QT: "No such slot" The problem is in your class declaration. You need something like the following: Source code 1 2 3 4 5 6 7 8 class Test : public QObject{ ... public slots: void slotPrint(); }; Go to the top of the page Skip user information Demoncleaner Beginner Posts: 8 3 Monday, September 20th 2004, 10