No Such Slot Qt Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings
Connect No Such Slot Mainwindow
and policies of this site About Us Learn more about Stack q_object undefined reference to vtable Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs qobject::connect: no such slot Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them;
Object Connect No Such Slot Qwidget
it only takes a minute: Sign up Qt connect “no such slot” when slot definitely does exist up 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:
Undefined Reference To Vtable Qt
(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 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, R
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 q_object macro company Business Learn more about hiring developers or posting ads with us Stack Overflow
Qt Slot
Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 qt moc 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 'No Such http://stackoverflow.com/questions/10656510/qt-connect-no-such-slot-when-slot-definitely-does-exist 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 update a var http://stackoverflow.com/questions/6735486/qt-no-such-slot 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-interface qt-creator signals-slots share|improve this question ask
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 http://www.qtforum.org/article/3201/runtime-error-from-qt-no-such-slot.html detail how this page works. To use all features of this page, you http://www.qtcentre.org/threads/45534-Object-connect-No-such-slot-QPushButton-enable() 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 no such 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 no such slot 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:38am Thanks for your answer, but after changing the visibility of public: void slotPrint(); to public slots: void slotPrint(); i get the same error. This post has been edited 1 times, last edit b
this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Welcome to Qt Centre. Qt Centre is a community site devoted to programming in C++ using the Qt framework. Over 90 percent of questions asked here gets answered. If you are looking for information about Qt related issue — register and post your question. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. + Reply to Thread Results 1 to 5 of 5 Thread: Object::connect: No such slot QPushButton::enable() Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 27th October 2011,11:02 #1 nthung View Profile View Forum Posts View Blog Entries View Articles Novice Join Date Nov 2009 Posts 59 Thanks 20 Thanked 1 Time in 1 Post Qt products Platforms Object::connect: No such slot QPushButton::enable() Qt Code: Switch view #ifndef MAINWINDOW_H#define MAINWINDOW_H#include