Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How I can access my label?
-
I want to change the text in my label but I can`t use ui outside of MainWindow::?How to do this?
-
It's a pointer, you can pass it around as any other variable - copy, make a function parameter, create a signal-slot connection... you choose.
A kinda basic approach would be to crate public "setter" method in your MainWindow and call it from wherever you want it.
-
Can you write me a code?
-
Of a setter function? C'mon... ;)
@
void MainWindow::setSomeLabelText(QString text)
{
ui.label->setText(text);
}
@