This is most gracefull way
Absolutely right
What text area you are using. Try this function call,
Qt Code:
yourTextArea->setText("Hello World !!");To copy to clipboard, switch view to plain text mode
This is most gracefull way
Absolutely right
What text area you are using. Try this function call,
Qt Code:
yourTextArea->setText("Hello World !!");To copy to clipboard, switch view to plain text mode
This is my code:
void MainWindow:n_pushButton_clicked()
{
textEdit->setText("Hello World !!");
}
textEdit is the name of the text box.
I have this error:
mainwindow.cpp: In member function `void MainWindow:n_pushButton_clicked()':
mainwindow.cpp:18: error: `textEdit' was not declared in this scope
mainwindow.cpp:18: warning: unused variable 'textEdit'
How can I declare my text box?
thanks
Hi there!
I guess you set the name of your QTextEdit to "textEdit" using the designer. Mind the case sensitivity!
If that's the case, then probably your UI-class is aggregated as pointer member:
Try:
ui->textEdit->setText("Hello World !!");
If you want to avoid that - I do - next time you create a Qt Designer Form Class select "Multiple Inheritance" in the "Embedding of the UI Class" Radiofield which you find when you click "More" (options) button on the second page of the QtCreator Wizard where you choose a class name ...
HIH
Johannes
Thanks very much, it works but i had to change setText by setPlainText
void MainWindow:n_buttonSend_released()
{
ui->textEdit>setPlainText("hello world!!");
}
I didn't understand what you talk about the class. I go to New, then I choose Qt Designer Form Class, Main window, more ->Multiple Inheritance and it overwrite my mainwindow.ui and mainwindow.cpp files
Can you explain to me some example about what I get doing it please?
Thanks you a lot
Hi!
When using multiple inheritance you can use:
without the ui!Qt Code:
void MainWindow::on_buttonSend_released() { textEdit->setPlainText("hello world!!"); }To copy to clipboard, switch view to plain text mode
Thats why it didn't work for you in the first place!
Joh
Bookmarks