Slots do not want to work in the loaded form through QUiLoader. Here is the base class constructor:

LoaderWidget::LoaderWidget(const QString &nwgt, QWidget * p): QWidget(p) { std::shared_ptr<QUiLoader> pUIl (new QUiLoader); QFile ui("/home/userc/authAstra/widgets/" + nwgt + ".ui"); if(ui.open(QIODevice::ReadOnly)) m_widget = pUIl.get()->load(&ui); if(ui.isOpen()) ui.close(); } 

Here is a child

 AuthWidget::AuthWidget(QWidget * parent) :LoaderWidget("auth", parent), local_auth_handle(NULL) { ui_loginBtn = m_widget->findChild<QPushButton*>("btnLogIn"); connect(ui_loginBtn, SIGNAL(clicked(bool)), SLOT(slot_authenticate_system())); } 

The slot is declared as public slots, connect does not swear, it just does not work at all. Although the code

 connect(ui_loginBtn, SIGNAL(clicked(bool)), qApp, SLOT(quit())); 

performed. Macro Q_OBJECT is. I do not understand why.

  • Maybe I don’t understand something, but connect(ui_loginBtn, SIGNAL(clicked(bool)), SLOT(slot_authenticate_system())); should not compile. - Ariox 7:42 pm
  • ... because that ... - magrif
  • @ ViktorSmirnov, the connection with the SIGNAL and SLOT macros for the compiler will be normal, and problems with incorrect connection will be noticed in runtime - gil9red

1 answer 1

 connect(ui_loginBtn, SIGNAL(clicked(bool)), SLOT(slot_authenticate_system())); 

Such a record is equivalent to the following

 connect(ui_loginBtn, SIGNAL(clicked(bool)), this, SLOT(slot_authenticate_system())); 

Those. the button's signal will search for the slot_authenticate_system slot in the AuthWidget object. If you need to send a signal to another object, then indicate clearly. It is not clear from the question context what qAuth

  • pardon, qApp is there - magrif