No such slot...
-
QObject::connect: No such slot <class name>::this->ResponseOneClicked() in <class name>.cpp:8 QObject::connect: (sender name: 'ResponseOneBtn')_ QObject::connect: (receiver name: '<classname>Class')
As you can see, I get this error when I try to use the slot. Here is the header file. Class name removed as it is kind of inappropriate.
class <class name> : public QMainWindow { Q_OBJECT public: <class name>(QWidget *parent = 0); ~<class name>; QPushButton* getResponseOne(); QPushButton* getResponseTwo(); QPushButton* getResponseThree(); QPushButton* getResponseFour(); QPushButton* getShowTweet(); QFrame* getTweetFrame(); public slots: void ResponseOneClicked(); void ResponseTwlClicked(); void ResponseThreeClicked(); void ResponseFourClicked(); void ShowTweet(); void ShowFrame();
what can I do to fix this? Am I doing it right?
-
Can you show how you connect the signal to that slot?
-
The problem is most probably this: SLOT(this->ResponseOneClicked()) - remove this->.
No need to use QObject:: in front of connect.
No need to use this-> in this->disableAndHide();
No need to use this-> in this->getResponseOne()
Why do you call this->getResponseOne() to get the pointer to the button? Don't you have the pointer in the same class already? -
connect(getResponseOne(), SIGNAL(clicked()), this, SLOT(ResponseOneClicked()));
-
No need to use QObject:: in front of connect.
True in principle. There are a few non-static overloads, however, and it's not a bad style to explicitly show the static function is used in this case. Overloading may get confusing if one of the other methods is used, e.g.:
connect(getResponseOne(), SIGNAL(clicked()), SLOT(ResponseOneClicked()));
-
@ProgrammerAtHeart3344 said:
this->disableAndHide();
Maybe by disabling your class , your slots are "disabled" too.
-
You're welcome , and you're free to post your new problem but in an another thread , to maintain information order in the forum :)
And please mark the topic as solved if it's the case :)
-
@ProgrammerAtHeart3344 said:
How do I mark the topic as solved?
Refer this
http://forum.qt.io/topic/62700/hitchhiker-s-visual-guide-to-the-qt-forum