Home > Mobile >  Only in the groove function change variables
Only in the groove function change variables

Time:10-09

I used signals and slots passing variables and found that after qDebug in slot function variables exist, but in other ways when using variable is always zero.

CodePudding user response:

Code, can help you to analysis

CodePudding user response:

Should be the value transfer didn't handle correctly

CodePudding user response:

refer to the second floor, shuicheng son reply:
should be value transfer didn't handle right

Signal:
QObject: : connect (this, SIGNAL (sendData publishes the event (QVector QVector) ), & amp; M, SLOT (receiveData (QVector QVector) ));
Emit sendData publishes the event (d_, st);

Tank:
The UI - & gt; Edit_sigle - & gt; SetText (" please enter "); Assignment of variables has been given to//is empty, so want to test the interface, the results showed that this passage not printed in the middle of the interface
Cal_info=d;
St=m;

Cal_info with st value in slot function to print is not empty, but in other ways to use is always empty

CodePudding user response:

QObject: : connect (this, SIGNAL (sendData publishes the event (QVector & QVector & amp;) ), & amp; M, SLOT (receiveData (QVector & QVector & amp;) ));
To pass the reference signal channel parameters to pass data correctly,

CodePudding user response:

reference liu4791 reply: 3/f
Quote: refer to the second floor, shuicheng son reply:

Should be the value transfer didn't handle right

Signal:
QObject: : connect (this, SIGNAL (sendData publishes the event (QVector QVector) ), & amp; M, SLOT (receiveData (QVector QVector) ));
Emit sendData publishes the event (d_, st);

Tank:
The UI - & gt; Edit_sigle - & gt; SetText (" please enter "); Assignment of variables has been given to//is empty, so want to test the interface, the results showed that this passage not printed in the middle of the interface
Cal_info=d;
St=m;

Cal_info with st value in slot function to print is not empty, but in other ways to use is always empty


You can't see the problem, your cal_info, d how two variables are defined, is a global variable? When used elsewhere have assignment are uncertain
st
  •  Tags:  
  • Qt
  • Related