[solved][Qt 5.4][QML] ios webview not working as expected
-
wrote on 25 Jun 2015, 09:59 last edited by kolegs
Hi
I got a problem with WebView component. I am trying to load a page but my url is never set. Whenever I check url its alweys empty string.
My simple code:
import QtQuick 2.0 import QtWebView 1.0 Item { width: 100 height: 62 z: 0 WebView{ width: parent.width height: parent.height url: "qrc:/hotel/html/index.html" } }
my pro file:
QT +=webview
-
Hi
I got a problem with WebView component. I am trying to load a page but my url is never set. Whenever I check url its alweys empty string.
My simple code:
import QtQuick 2.0 import QtWebView 1.0 Item { width: 100 height: 62 z: 0 WebView{ width: parent.width height: parent.height url: "qrc:/hotel/html/index.html" } }
my pro file:
QT +=webview
@kolegs AFAIK
WebView
just invokes the web browser that is native to the underlying operating system and thus it may not understand how to load file from Qt's Resource System. -
wrote on 25 Jun 2015, 10:19 last edited by m_andrej
WebView element is actually a wrapped native iOS web view. It won't work with a Qt resource file. You should try something like this:
Your *.pro file:ios { BUNDLE_DATA.files = $$$$files($$$$PWD/resources/index.html) // it should be double dollar signs here! QMAKE_BUNDLE_DATA += BUNDLE_DATA }
Your *.qml file:
WebView { width: parent.width height: parent.height url: "./index.html" }
Make sure resources/index.html is present in your source code directory.
-
wrote on 25 Jun 2015, 10:33 last edited by
You may be right but why isn't working with remote pages(tried www.google.pl), and why url string is always empty.
-
You may be right but why isn't working with remote pages(tried www.google.pl), and why url string is always empty.
@kolegs Perhaps you should try prepending http:// to the url.
-
wrote on 25 Jun 2015, 11:32 last edited by
Dont know why but it works with Qt 5.5RC version without any changes in code
5/6