vnote/vpreviewpage.cpp
Le Tan 7bce2cb298 use QWebEngineView to display markdown files
Thanks to [marked JavaScript library](https://github.com/chjj/marked) by
Christopher Jeffrey. The
[style sheet](http://kevinburke.bitbucket.org/markdowncss/markdown.css)
was created by Kevin Burke.

Signed-off-by: Le Tan <tamlokveer@gmail.com>
2016-10-09 20:47:20 +08:00

20 lines
492 B
C++

#include "vpreviewpage.h"
#include <QDesktopServices>
VPreviewPage::VPreviewPage(QWidget *parent) : QWebEnginePage(parent)
{
}
bool VPreviewPage::acceptNavigationRequest(const QUrl &url,
QWebEnginePage::NavigationType /*type*/,
bool /*isMainFrame*/)
{
// Only allow qrc:/index.html.
if (url.scheme() == QString("qrc"))
return true;
QDesktopServices::openUrl(url);
return false;
}