Somewhere, probably in main, you instantiate and show Principale; that is, you have code like:
// one way:
//
Principale primaryWindow;
primaryWindow.show();
//
// or, another way:
//
Principale* primaryWindowPointer = new Principale();
primaryWindowPointer->show();
// one way:
//
Principale primaryWindow;
primaryWindow.show();
//
// or, another way:
//
Principale* primaryWindowPointer = new Principale();
primaryWindowPointer->show();
To copy to clipboard, switch view to plain text mode
In your new code, you need:
// one way:
//
primaryWindow.ui->abc->setText("xyz");
//
// or, another way:
//
primaryWindowpointer->ui->abc->setText("xyz");
// one way:
//
primaryWindow.ui->abc->setText("xyz");
//
// or, another way:
//
primaryWindowpointer->ui->abc->setText("xyz");
To copy to clipboard, switch view to plain text mode
How you get “primaryWindow” or “primaryWindowPointer” to your new code depends on how you call the new code. If it’s called from main (or whatever routine creates and shows an instance of Principale), pass the same variable as an argument to your code. If it’s called from a member function of Principale, pass the this pointer.
You could also pass primaryWindow.ui->abc directly to your new code, if it only needs that one object.
There are any number of ways accomplish this, but somehow your new code must get a pointer to the relevant instance of abc to able to apply setText.
Bookmarks