Connect Signal with Argument via Lambda to Slot with Argument?
Unsolved
General and Desktop
-
Ok.. hi..
Following Situation:
I crated a QDialog with this Signals:signals: void created(QString _path); void aborted();
Inside the Window, that calls this Dialog, i want to Connect a Slot:
private slots: void _onOpenproject(QString _path);
With the Dialogs Signal..
My current call and Connect is this:
void TGS_WindowProjectLibrary::_onNewProject() { TGS_Dialog_NewProject _newProj; connect(&_newProj,&TGS_Dialog_NewProject::created,this,[this]{ _onOpenproject();} ); _newProj.exec(); }
Question now:
How to connect the SIGNALs QString with the SLOTs? -
@BDC_Patrick said in Connect Signal with Argument via Lambda to Slot with Argument?:
How to connect the SIGNALs QString with the SLOTs?
connect(&_newProj,&TGS_Dialog_NewProject::created,this,[this](QString str){ _onOpenproject(str);} );
But why don't you connect the signal directly to the slot?
-
@BDC_Patrick
no need for a lambda here:connect(&_newProj,&TGS_Dialog_NewProject::created,this, &TGS_WindowProjectLibrary::_onOpenproject);
if you insist on using a lambda;
connect(&_newProj,&TGS_Dialog_NewProject::created,this,[this](QString argument)->void{ _onOpenproject(argument);} );