New with Qt 5.8 is the print() functionality with the QWebEnginePage class - http://doc.qt.io/qt-5/qwebenginepage.html#print . I'm trying to port some old programs that used QWebView to print to pdf to this new approach, and I'm having trouble understanding the second parameter required for the print function. The documentation says it is expecting a FunctorOrLambda resultCallback. I'm new-ish to both Qt and C++, so I have yet to fully get my head around the concept of functors or lambdas. That I can learn, but first I'm just trying to grasp the overall purpose of the second parameter of print and what exactly is expected. Based on the documentation and this blogpost, am I understanding correctly that the print function is looking for some reference to a function that makes sure the printer stays valid until printing is successful? If so, any hints on how I might approach that in the below code structure that I am already working with?
Qt Code:
  1. QWebEngineView *view = new QWebEngineView();
  2. view->setHtml(htmlString);
  3.  
  4. QPrinter pdfPrinter(QPrinter::HighResolution);
  5.  
  6. view->page()->print(&pdfPrinter, HELP_REQUIRED_HERE);
To copy to clipboard, switch view to plain text mode 

Anything to help me understand would be greatly appreciated!