Following code throws following errors on line with "function(iteratorIndex);":
- must use '.' or '->' to call pointer-to-member function
- called object type 'void (MainWindow::)(QMap<QPushButton, QHBoxLayout*>::const_iterator&) is not a function or function pointer
void MainWindow::ForEachInLayoutMap(void(MainWindow::*function)(QMap<QPushButton*, QHBoxLayout*>::const_iterator&))
{
QMap<QPushButton*, QHBoxLayout*>::const_iterator iteratorIndex = deleteButtonToIngredientLayoutMap.constBegin();
QMap<QPushButton*, QHBoxLayout*>::const_iterator endIterator = deleteButtonToIngredientLayoutMap.constEnd();
while (iteratorIndex !=endIterator)
{
function(iteratorIndex);
iteratorIndex++;
}
}
Any ideas how should I solve this?