user3443063
user3443063

Reputation: 1615

qt c++ signal slot connections for data exchange between objects

I´m stuck on the following problem:

I have a QWidget named PBVars with lots of line-edits that are filled in by a read-routine. Now I want to give the user a chance to edit some fields without having to delete all entries. For that I thought to open a new dialog (named EGG) and to copy all the data into EGG. Now the user can change data, click "SaveValuesToGUI" and the values are saved back to PBVars. This is may idea.

I managed to read all data from PBVars -> EGG. But I´m stuck in creating a signal-slot-connection back from EGG -> PBVars.

PBVars.h :

...    
EGG *   egg ;

PBVars.cpp :

PBVars::PBVars(QWidget *parent) :
Tab(parent), ui(new Ui::PBVars)
{
 ....      
 egg = new EGG();
 }

  void PBVars::on_but_EditGeometry_clicked()
  {  ...
     // fill Values_from_PBVars here
     egg->show();
     egg->setLneEdits(Values_from_PBVars);
   }

Where and how do I write the connect. I think it should be somewhat like

  connect(  egg ???, SIGNAL(on_pb_sendValuesToPropBasic_clicked()), 
        this, SLOT(write_GGE_ToPBVars(qsl) ));

where qsl is the Stringlist with the edited values of egg.

can anybody help me please ? Thank you !!

Upvotes: 0

Views: 372

Answers (1)

dtech
dtech

Reputation: 49289

If you want your connections to transmit data, you have to have matching parameters in the signal and the slot:

void someSignal(int)
...
void someSlot(int i) { ...use i here... }

And the actual parameter is specified when you emit the signal emit someSignal(someInt).

Upvotes: 3

Related Questions