I need to display a text in a QTextEdit after I clicked on a button.
I have:
QGroupBox *groupDefClass = new QGroupBox("Definition of the class");
QFormLayout *formDefClass = new QFormLayout;
QLineEdit *name = new QLineEdit;
QLineEdit *motherClass = new QLineEdit;
formDefClass->addRow("&Name:", name);
formDefClass->addRow("Mother Class :", motherClass);
groupDefClass->setLayout(formDefClass);
QVBoxLayout *vertBoxAll = new QVBoxLayout;
vertBoxAll->addWidget(groupDefClass);
Then I have another textBox somewhere else:
textResult = new QTextEdit();
vertBoxAll->addWidget(textResult);
And I wanted to add the "code" using this button:
generButton = new QPushButton("Generate...");
connect(generButton, SIGNAL(clicked()), this, SLOT(getData(code)));
And the getData:
void SetUpPage::getData(QString code) {
textResult->setPlainText(code);
textResult->setReadOnly(true);
textResult->setFont(QFont("Courier"));
textResult->setLineWrapMode(QTextEdit::NoWrap);
}
But nothing happens.
I also tried to add textResult->setPlainText(code) directly in the SLOT (not sure if I can do that) but still nothing.
I really don't see what I'm doing wrong. Thanks in advance for your help.
Laurent