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:
void class1::Open()
{
// opened a folder & and extract a list of directories ...
for(int i = 0; i < directoryList.size(); i++)
{
std::cout << directoryList[i].toStdString() << std::endl;
DirWidget *dirWidgetPtr = new DirWidget(directoryList[i]);
signalMapper->setMapping(dirWidgetPtr->_buttonPtr, directoryList[i]);
connect(dirWidgetPtr->_buttonPtr, SIGNAL(clicked()), signalMapper, SLOT(map()));
_flowLayoutPtr->addWidget(dirWidgetPtr);
}
connect(signalMapper,
SIGNAL(mapped
(QString)),
this,
SLOT(GetDir
(QString)));
}
void class1::Open()
{
// opened a folder & and extract a list of directories ...
QSignalMapper *signalMapper = new QSignalMapper(this);
for(int i = 0; i < directoryList.size(); i++)
{
std::cout << directoryList[i].toStdString() << std::endl;
DirWidget *dirWidgetPtr = new DirWidget(directoryList[i]);
signalMapper->setMapping(dirWidgetPtr->_buttonPtr, directoryList[i]);
connect(dirWidgetPtr->_buttonPtr, SIGNAL(clicked()), signalMapper, SLOT(map()));
_flowLayoutPtr->addWidget(dirWidgetPtr);
}
connect(signalMapper, SIGNAL(mapped(QString)), this, SLOT(GetDir(QString)));
}
To copy to clipboard, switch view to plain text mode
Bookmarks