1

I'm having problems with qtwebkit in ubuntu for devices (Nexus 10) when using pyqt5, the webview element doesn't show, and the application closes. But if I test the same .qml file with qmlscene it works, but the webview is on fullscreen size.

If I comment the height and width lines the python app keeps running but with the screen in white.

This is the testQt5.py file:

import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtQuick import QQuickView

app = QApplication(sys.argv)

view = QQuickView()
view.setSource(QUrl("file:///home/phablet/Documents/GUIWK.qml"))
view.show()

app.exec()

GUIWK.qml file:

import QtQuick 2.0
import QtWebKit 3.0
import Ubuntu.Components 0.1

MainView {
    width: units.gu(120)
    height: units.gu(80)
    Rectangle {
        id: content
        anchors.fill: parent
        WebView{
            height: content.height
            width: content.width
            id: webview
            url: "http://www.google.com"
        }
    }
}

testQt5.desktop file:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
#Exec=python3 /home/phablet/Documents/testQt5.py
Exec=/usr/bin/qmlscene $@ /home/phablet/Documents/GUIWK.qml
Icon=qmlscene
Name=testQt5
X-Ubuntu-Touch=true

I run the app but it doesn't show anything special in the log file at ~/.cache/upstart :

creating surface at (0, 64) with size (2560, 1536) with title 'Window 1'
1
  • Does replacing import QtWebKit 3.0 with import com.canonical.Oxide 1.0 fix the issue?
    – dobey
    Jul 1, 2014 at 18:54

1 Answer 1

1

QtWebKit is not the supported API in the SDK to use for phones. You need to use Oxide instead.

You can do this with:

import com.canonical.Oxide 1.0

It provides mostly the same API as QtWebKit does.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .