The Open() function will be initiate a number of times based on user's preference.
I learned that QSignalMapper will be clear by it's parent upon the destruction of application.
But what would happened in this case?

Below are the code snippet:

Qt Code:
  1. void class1::Open()
  2. {
  3. // opened a folder & and extract a list of directories ...
  4.  
  5. QSignalMapper *signalMapper = new QSignalMapper(this);
  6. for(int i = 0; i < directoryList.size(); i++)
  7. {
  8. std::cout << directoryList[i].toStdString() << std::endl;
  9.  
  10. DirWidget *dirWidgetPtr = new DirWidget(directoryList[i]);
  11. signalMapper->setMapping(dirWidgetPtr->_buttonPtr, directoryList[i]);
  12. connect(dirWidgetPtr->_buttonPtr, SIGNAL(clicked()), signalMapper, SLOT(map()));
  13. _flowLayoutPtr->addWidget(dirWidgetPtr);
  14.  
  15. }
  16. connect(signalMapper, SIGNAL(mapped(QString)), this, SLOT(GetDir(QString)));
  17. }
To copy to clipboard, switch view to plain text mode