1
코드가 이상합니다.Qt C++ 신호 슬롯이 제대로 작동하지 않습니다.
신호 슬롯 연결을 설정하고 싶습니다. 매개 변수가 없으면 정상적으로 작동합니다. 그러나 int와 같은 쉬운 것처럼 매개 변수를 사용할 때 연결이 작동하지 않습니다. 누군가가 그 이유에 대한 단서를 가지고 있습니까?
고맙습니다.
이 작동 :
Chart.h
void signalForUI();
Chart.cpp
emit signalForUI();
Userinterface.h
public slots:
void UI_schreibtWas();
Userinterface.cpp
connect( ui.Diagram , SIGNAL(signalForUI() ),
this ,SLOT (UI_schreibtWas())) ;
...
void UserInterface::UI_schreibtWas()
{ qDebug() << "ich schreibe was- ohne "; }
이 어쩌려 구`t :
Chart.h
void signalForUI(const int &X_send);
Chart.cpp
emit signalForUI(5);
Userinterface.h
public slots:
void UI_schreibtWas(const int &X_send);
Userinterface.cpp
connect( ui.Diagram , SIGNAL(signalForUI(const int &X_send) ),
this ,SLOT (UI_schreibtWas(const int &X_send))) ;
...
void UserInterface::UI_schreibtWas(const int &X_send)
{ qDebug() << "ich schreibe was - int "; }
연결에서 'X_send'를 제거하십시오. 매개 변수 유형을 사용하기 만하면됩니다. – drescherjm
그래서 connect (ui.Diagram, SIGNAL (signalForUI (const int &))), this, SLOT (connect) , this, SLOT (UI_schreibtWas (const int &))) ;' – drescherjm