I get a head from QWebEngine. It's great. I have a job.
The lambada capture should be all that is "=", or "this" in the event of a signal. You will also need to “modify” to modify the captured copies. toHtml() , however, is asynchronous, so even if you capture html, it is unlikely to be available immediately after calling toHtml() in SomeFunction . You can overcome this by using a signal and a slot.
protected slots: void handleHtml(QString sHtml); signals: void html(QString sHtml); void MainWindow::SomeFunction() { connect(this, SIGNAL(html(QString)), this, SLOT(handleHtml(QString))); view->page()->toHtml([this](const QString& result) mutable {emit html(result);}); } void MainWindow::handleHtml(QString sHtml) { qDebug()<<"myhtml"<< sHtml; }
source share