void QWebFrameProto::scrollToAnchor(const QString & anchor) { scriptDeprecated("QWebFrame will not be available in future versions"); QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject()); if (item) item->scrollToAnchor(anchor); }
void RevDesc::on_anchorClicked(const QUrl& link) { static QRegularExpression anchorRE("^#(.+)$"); qDebug() << "clicked on " << link.toDisplayString() << "\n"; QWebFrame* frame = this->page()->mainFrame(); QRegularExpressionMatch anchorMatch = anchorRE.match(link.toDisplayString()); if(anchorMatch.hasMatch()) { frame->scrollToAnchor(anchorMatch.captured(1)); } }