How to use QTextEdit
-
@Gojir4 said in How to use QTextEdit:
@jenya7 Of course. It is only visible in MainWindow.
You need to add a method (or slot) in your MainWindow allowing to access the control, or to set the text
void MainWindow::setTerminalText(const QString &txt){
ui->textEditTerminalRx->setText(txt);
}
OOI, how does this help? How does a different class/module/form get any access to the
MainWindow
instance to call that method, any more than to theui
?@JonB said in How to use QTextEdit:
@Gojir4 said in How to use QTextEdit:
@jenya7 Of course. It is only visible in MainWindow.
You need to add a method (or slot) in your MainWindow allowing to access the control, or to set the text
void MainWindow::setTerminalText(const QString &txt){
ui->textEditTerminalRx->setText(txt);
}
OOI, how does this help? How does a different class/module/form get any access to the
MainWindow
instance to call that method, any more than to theui
?@JonB said in How to use QTextEdit:
You either need to decide to gain access to the main window's text edit so that you can set its text directly, or (perhaps more suitable for your use case) you could have it raise a signal when stuff is"going on", and the main window could place a slot on that signal so that it updates the text edit.
:P thanks for this moment of fun
-
@JonB said in How to use QTextEdit:
@Gojir4 said in How to use QTextEdit:
@jenya7 Of course. It is only visible in MainWindow.
You need to add a method (or slot) in your MainWindow allowing to access the control, or to set the text
void MainWindow::setTerminalText(const QString &txt){
ui->textEditTerminalRx->setText(txt);
}
OOI, how does this help? How does a different class/module/form get any access to the
MainWindow
instance to call that method, any more than to theui
?@JonB said in How to use QTextEdit:
You either need to decide to gain access to the main window's text edit so that you can set its text directly, or (perhaps more suitable for your use case) you could have it raise a signal when stuff is"going on", and the main window could place a slot on that signal so that it updates the text edit.
:P thanks for this moment of fun