Set History to a QWebPage
-
hi :
i am wondering if there is a way to set the history to a QWebPage? i found a history() interface in the QWebPage,but it's const which means we can not set it.
My scenario is i want to save the previous page's history and set it to the new created page. Does anyone done that before or any ideas? thank you -
Save history from QWebView:
@
// view is QWebView*
QByteArray historyData;
QDataStream historyStream(&historyData, QIODevice::WriteOnly);
historyStream << *view->history();
@Restore history from QByteArray into QWebView:
@
// historyData is QByteArray with previously saved history
// view is QWebView*
QDataStream historyStream(historyData);
historyStream >> *view->history();
@ -
this seems not work right, history() doesn't have the ">>" operand method
[quote author="nowrep" date="1330721372"]Save history from QWebView:
@
// view is QWebView*
QByteArray historyData;
QDataStream historyStream(&historyData, QIODevice::WriteOnly);
historyStream << *view->history();
@Restore history from QByteArray into QWebView:
@
// historyData is QByteArray with previously saved history
// view is QWebView*
QDataStream historyStream(historyData);
historyStream >> *view->history();
@[/quote]