From cb9649d186685761d93b097bc7abf9d34832065e Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 27 Sep 2018 16:49:05 +0200 Subject: [PATCH] initial attempt about how to make use of the webengine stuff --- playground/playground.pro | 6 ++++ playground/webview/main.cpp | 54 ++++++++++++++++++++++++++++++++++ playground/webview/webview.pro | 9 ++++++ 3 files changed, 69 insertions(+) create mode 100644 playground/webview/main.cpp create mode 100644 playground/webview/webview.pro diff --git a/playground/playground.pro b/playground/playground.pro index eda45616..256f8c61 100644 --- a/playground/playground.pro +++ b/playground/playground.pro @@ -7,3 +7,9 @@ SUBDIRS += \ invoker \ inputpanel \ images + +qtHaveModule(webengine) { + + SUBDIRS += \ + webview +} diff --git a/playground/webview/main.cpp b/playground/webview/main.cpp new file mode 100644 index 00000000..2798ec11 --- /dev/null +++ b/playground/webview/main.cpp @@ -0,0 +1,54 @@ +/****************************************************************************** + * QSkinny - Copyright (C) 2016 Uwe Rathmann + * This file may be used under the terms of the 3-clause BSD License + *****************************************************************************/ + +#include +#include + +#include +#include + +#include +#include + +#include + +class WebView : public QQuickWebEngineView +{ +public: + WebView( const char* url, QQuickItem* parent = nullptr ) + : WebView( parent ) + { + setUrl( QUrl( url ) ); + } + + WebView( QQuickItem* parent = nullptr ) + : QQuickWebEngineView( parent ) + { + } +}; + +int main( int argc, char* argv[] ) +{ +#ifdef ITEM_STATISTICS + QskObjectCounter counter( true ); +#endif + + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app( argc, argv ); + + QtWebEngine::initialize(); + + SkinnyFont::init( &app ); + SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugShortcuts ); + + QskWindow window; + + window.addItem( new WebView( "https://github.com/uwerat/qskinny" ) ); + window.resize( 800, 600 ); + window.show(); + + return app.exec(); +} diff --git a/playground/webview/webview.pro b/playground/webview/webview.pro new file mode 100644 index 00000000..3a788c32 --- /dev/null +++ b/playground/webview/webview.pro @@ -0,0 +1,9 @@ +include( $${PWD}/../playground.pri ) + +QT += webengine +QT += webengine-private + +TARGET = webview + +SOURCES += \ + main.cpp