[SailfishDevel] Creating a Webapp Application with WebView

Daniel Beck d.danielbeck at googlemail.com
Sat Aug 16 19:41:39 UTC 2014


Hi Alessandro,

according to http://www.devicepixelratio.com/, the webview shows a
devicepixelratio of 1 when embedded in a QML application.

Here is the code used to embed the webview:

import QtQuick 2.0
import Sailfish.Silica 1.0
import QtWebKit 3.0

ApplicationWindow
{
    initialPage: Component {
        Page {
            id: page
            SilicaFlickable {
                anchors.fill: parent
                contentHeight: column.height
                WebView {
                          id: webView
                          anchors.fill: parent
                          url: "http://www.devicepixelratio.com/"
                      }
            }
        }
    }
}


Greetings
Daniel





2014-08-16 16:14 GMT+02:00 Alessandro Portale <alessandro at casaportale.de>:

> Most likely Daniel has the correct 960x540 device pixels. But I assume
> that he gets a devicePixelRatio of 1, which is too low for the Jolla
> device. With 244 PPI (I assume that's what the Jolla phone has) it
> should be a 2.0.
>
> What does the Jolla browser or the webview show here?
> http://www.devicepixelratio.com/
>
> On Sat, Aug 16, 2014 at 12:03 PM, Andrea Bernabei
> <and.bernabei at gmail.com> wrote:
> > Hi Daniel :)
> >
> > could you please elaborate more?
> > What's the issue you're having?
> >
> > 960x540 is the resolution of the screen
> >
> >
> > 2014-08-16 11:55 GMT+02:00 Daniel Beck <d.danielbeck at googlemail.com>:
> >>
> >> Hello,
> >>
> >> I would like to create a webapp game application that runs inside a
> >> WebView.
> >> The problem is that the resolution reported by the HTML application is
> >> 960x540. The viewport of the HTML is set as follows:
> >>
> >> <meta name="viewport" content="width=device-width, initial-scale=1">
> >>
> >>
> >> Apparently, the webview does not honnor the device pixel ration (DPR) of
> >> the device.
> >> Is there some property/configuration I can set for this in the QML?
> >>
> >> WebView {
> >>                           id: webView
> >>                           anchors.fill: parent
> >>                           url: "index.html"
> >> }
> >>
> >>
> >> Thanks
> >> Daniel
> >>
> >> _______________________________________________
> >> SailfishOS.org Devel mailing list
> >> To unsubscribe, please send a mail to
> >> devel-unsubscribe at lists.sailfishos.org
> >
> >
> >
> > _______________________________________________
> > SailfishOS.org Devel mailing list
> > To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140816/d71bc2ad/attachment.html>


More information about the Devel mailing list