title: how to convert string as qwidget in qt
body: <p>How to convert string as qwidget in qt. Dynamically have to access.. Any other method is having to convert string to QWidget.</p>
  
  <p>Sample code:</p>
  
  <pre><code>QWidget *widget1 = new QWidget();
  QWidget *widget2 = new QWidget();
  
  QPushButton *next = new QPushButton("next");
  QPushButton *prev = new QPushButton("prev");
  
  stack-&gt;addWidget(widget1);
  stack-&gt;addWidget(widget2);
  
  stack-&gt;setCurrentIndex(0);
  
  QObject::connect(next, SIGNAL(clicked()), this, SLOT(NextBt()));
  
  QObject::connect(prev, SIGNAL(clicked()), this, SLOT(PrevBt()));
  
  void MainWindow::NextBt()
  {
  
  std::string str1 = "widget" + std::to_string(1);
  QString str = str1.c_str();    // "widget1"
  
  //How to implement QWidget object as conversion of String here.
  //for dynamically i want to remove the already added widget.
  
  stack-&gt;removeWidget(str);
  str-&gt;deleteLater();
  stack-&gt;setCurrentIndex(1);
  
  }
  </code></pre>