0

I'm creating dynamic widgets using the following code:

//class constructor
counter = 0; //int

//class method
vec_txt.push_back(new QTextBrowser()); //vector
ui->stackedWidget->addWidget(vec_txt[counter]);
counter++;

Now, I want to save the text in a file, but I don't know how to access the QTextBrowser object that is in the QStackWidget stackedWidget.

Is it even possible?

IAmInPLS
  • 4,051
  • 4
  • 24
  • 57
Chechen Itza
  • 111
  • 8

1 Answers1

0

Yes, it is possible, just retrieve the widget at the desired index with this method :

QTextBrowser* textBrowser = qobject_cast<QTextBrowser*>(stackedWidget->widget(index)); 
IAmInPLS
  • 4,051
  • 4
  • 24
  • 57