Skip to content

Commit

Permalink
Add POC for web view
Browse files Browse the repository at this point in the history
  • Loading branch information
uglide committed Nov 24, 2015
1 parent b12ed12 commit ea31f2b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main.cpp
Expand Up @@ -3,6 +3,7 @@
#include <QDir>
#include <QSettings>
#include <QFontDatabase>
#include <QtWebEngine/QtWebEngine>
#include <googlemp.h>

#ifndef RDM_VERSION
Expand All @@ -14,6 +15,7 @@
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QtWebEngine::initialize();

#ifndef QT_DEBUG
CrashHandler::instance()->Init(QDir::homePath());
Expand Down
2 changes: 1 addition & 1 deletion src/rdm.pro
Expand Up @@ -4,7 +4,7 @@
#
#-------------------------------------------------

QT += core gui network concurrent widgets quick quickwidgets
QT += core gui network concurrent widgets quick quickwidgets webengine

TARGET = rdm
TEMPLATE = app
Expand Down
1 change: 1 addition & 0 deletions src/resources/qml/3rdparty/highlightjs/default.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/resources/qml/3rdparty/highlightjs/highlight.min.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/resources/qml/value-editor.qml
Expand Up @@ -3,6 +3,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1
import QtQuick.Dialogs 1.2
import QtWebEngine 1.1
import "."
import "./editors/formatters/formatters.js" as Formatters

Expand All @@ -25,6 +26,25 @@ Rectangle {
viewModel.setCurrentTab(index)
}

Tab {
title: "web_view!"

WebEngineView {
id: webview

anchors.fill: parent

Component.onCompleted: {
var json_editor = '<html><head><link rel="stylesheet" href="qrc:/highlight.css"></head><body>'
+ '<pre><code>{"a": true}</code></pre>'
+ '<script src="qrc:/highlight.js"></script>'
+ '<script>hljs.initHighlightingOnLoad();</script></body></html>'

webview.loadHtml(json_editor)
}
}
}

WelcomeTab {
objectName: "rdm_qml_welcome_tab"
property bool not_mapped: true
Expand Down
2 changes: 2 additions & 0 deletions src/resources/rdm.qrc
Expand Up @@ -48,5 +48,7 @@
<file>qml/AddKeyDialog.qml</file>
<file>qml/parts/RichTextWithLinks.qml</file>
<file>qml/3rdparty/php-unserialize-js/phpUnserialize.js</file>
<file alias="highlight.css">qml/3rdparty/highlightjs/default.min.css</file>
<file alias="highlight.js">qml/3rdparty/highlightjs/highlight.min.js</file>
</qresource>
</RCC>

0 comments on commit ea31f2b

Please sign in to comment.