ReaderView
::ReaderView(QWidget *parent
) : QQuickWidget(parent)
{
decrypt = new Decrypt();
webView = new WebEngineView();
context = this->rootContext();
context->setContextProperty("rw",this);
qmlRegisterType<WebEngineView>("WebView",1,0,"WebEngineView");
setSource
(QUrl("qrc:/ReaderView.qml"));
QQmlComponent component(engine());
component.
loadUrl(QUrl("qrc:/ReaderView.qml"));
object = component.create(context);
qDebug()<<component.errors();
displayPage();
}
void ReaderView::displayPage()
{
QString content
= decrypt
->decryptFile
("/Users/user/ssparklContent/CUPIGrade6-20150519_1977/Pages/05_preface.html",
'A');
QUrl url
= QUrl("file:///Users/user/ssparklContent/CUPIGrade6-20150519_1977/Pages/05_preface.html");
}
WebEngineView
::WebEngineView(QWidget *parent
) : QWebEngineView(parent)
{
setGeometry(0,0,1300,800);
}
void WebEngineView
::setCurrentPage(QString content,
QUrl baseUrl
) {
// setHtml(content,baseUrl);
}
//ReaderView.qml
import QtQuick 2.0
Rectangle {
id: rect1
height: 800
width: 1300
color: "white"
function loadpage(pgcontent,url)
{
browserwindow.loadCurrentPage(pgcontent,url)
}
BrowserWindow {
id: browserwindow
height: parent.height - 30
width:parent.width
y:15
clip:true
}
}
//BrowserWindow.qml
import QtQuick 2.0
import WebView 1.0
Rectangle {
id:flick
height: parent.height
width: parent.width - 5
function loadCurrentPage(pagecontents, url)
{
webEngineView.setCurrentPage(pagecontents,url)
}
WebEngineView {
id: webEngineView
// height: parent.height
// width: parent.width
}
}
ReaderView::ReaderView(QWidget *parent)
: QQuickWidget(parent)
{
decrypt = new Decrypt();
webView = new WebEngineView();
context = this->rootContext();
context->setContextProperty("rw",this);
qmlRegisterType<WebEngineView>("WebView",1,0,"WebEngineView");
setSource(QUrl("qrc:/ReaderView.qml"));
QQmlComponent component(engine());
component.loadUrl(QUrl("qrc:/ReaderView.qml"));
object = component.create(context);
qDebug()<<component.errors();
displayPage();
}
void ReaderView::displayPage()
{
QString content = decrypt->decryptFile("/Users/user/ssparklContent/CUPIGrade6-20150519_1977/Pages/05_preface.html", 'A');
QUrl url = QUrl("file:///Users/user/ssparklContent/CUPIGrade6-20150519_1977/Pages/05_preface.html");
QMetaObject::invokeMethod(object, "loadpage",Q_ARG(QVariant,content),Q_ARG(QVariant,url));
}
WebEngineView::WebEngineView(QWidget *parent)
: QWebEngineView(parent)
{
setGeometry(0,0,1300,800);
}
void WebEngineView::setCurrentPage(QString content, QUrl baseUrl)
{
// setHtml(content,baseUrl);
}
//ReaderView.qml
import QtQuick 2.0
Rectangle {
id: rect1
height: 800
width: 1300
color: "white"
function loadpage(pgcontent,url)
{
browserwindow.loadCurrentPage(pgcontent,url)
}
BrowserWindow {
id: browserwindow
height: parent.height - 30
width:parent.width
y:15
clip:true
}
}
//BrowserWindow.qml
import QtQuick 2.0
import WebView 1.0
Rectangle {
id:flick
height: parent.height
width: parent.width - 5
function loadCurrentPage(pagecontents, url)
{
webEngineView.setCurrentPage(pagecontents,url)
}
WebEngineView {
id: webEngineView
// height: parent.height
// width: parent.width
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks