Signals and slots didn't emitted
Unsolved
General and Desktop
-
Hai everyone, I want to ask something. My code didn't emit to slot, this is my code
// maingui.h public slots : void getLimit(); // maingui.cpp #include "setlimitvolt.h" ... MainGUI::MainGUI(QWidget *parent, int type) : QWidget(parent), ui(new Ui::MainGUI) { this->limitType = type; ui->setupUi(this); SetLimitVolt *LimitV = new SetLimitVolt(); connect(LimitV,SIGNAL(limiting()), this, SLOT(getLimit())); } void MainGUI::getLimit(){ qDebug() << "test"; }
and I want to emit my code from other class
// setlimitvolt.h signals : void limiting(); // setlimitvolt.cpp void SetLimitVolt::on_lineEdit_editingFinished() { emit limiting(); }
Is there any wrong code ?
-
@mimamrafi Please use new Qt5 connect syntax to make sure the connect succeeded: https://doc.qt.io/qt-5/signalsandslots.html
Next: you define LimitV in MainGUI and do NOT show it. My guess is that you have another LimitV member in your MainGUI class which you actually want to use. Please show whole MainGUI header file.