A
A
Anton2015-12-25 23:38:43
Qt
Anton, 2015-12-25 23:38:43

Why does the "No such slot" error occur?

Hello!
There are slots. There are no problems with them. Added one more by analogy.
In the header file in public slots: I wrote void UserSettingsSave ();
In the method void UserSettings(); wrote:

save_button->connect(save_button, SIGNAL(clicked(bool)), this, SLOT(UserSettingsSave()));

And it doesn't work. Writes:
QObject::connect: No such slot MainWindow::UserSettingsSave()
QObject::connect: (sender name: 'save_button')
QObject::connect: (receiver name: 'MainWindow')

There is a similar line above:
profile_button->connect(profile_button, SIGNAL(clicked(bool)), this, SLOT(UserProfile()));

Which does its job perfectly and does not cause errors.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
Jacob E, 2015-12-26
@hummingbird

  • First, the profile_button-> at the beginning of the line is not needed
  • Third, try running qmake
  • Fourth, read about the new signal and slot syntax
  • Fifth, it is not customary to name methods with a capital letter, only classes

M
Mercury13, 2015-12-26
@Mercury13

Sometimes Qt Creator glitches and a complete recompilation of the project is required.
For some reason, MOC did not start.

J
jackroll, 2015-12-26
@jackroll

We probably need to review the entire code?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question