I've got a question about signals and slots. In my app, I want to connect a signal from one object to a textEdit
in a dialog window. My signal emits a QString
; if I violate encapsulation (by making the UI public instead of private) and connect the signal directly to the textEdit
it works. But I feel that it's not the right way. If I make something like the following:
connect(m_osgWidget->picker.get(), SIGNAL(setX(QString)), m_addAgentDlg, SLOT(getX(QString)));
where:
void getX(QString)
{
this->ui.textEdit(QString);
}
It gives me an error that I can't use QString
in this this->ui.textEdit(QString);
I need the QString
from setX()
signal pasted into the textEdit
of m_addAgentDlg
. How this can be done? Where did I make a mistake?