Sailfish Share API and Sailfish WebView

Hello Fellow Developers!

The Sailfish OS 4.2.0 release brought a lot of improvements, but I’m quite sure many of you didn’t notice two items, as they weren’t really properly advertised in the release notes:

We now have two new Harbour-allowed APIs:

Happy hacking!


Thank you for documentation. Btw, for sharing api, it would be great to signalize that some resource (shared file) is temporary and should be removed when it is transferred completely. It is not nice when application is leaving some garbage in /tmp.


Cool. I can put sharing back into Imageworks. Nice. Tobias will be happy too.


Not to mention /tmp will be separated between jailed app instances if i understand it correctly.


Ah, Imageworks creates (of necessity) tmp in user local storage, so I don’t have to worry about that bit. Is it that common to use system /tmp? I mean, nn the servers I build I use it but generally have a relatively limited number of services using it, so it’s rarely an issue. On the desktop (laptop) I actually sometimes run out of space on / :slight_smile: Time to replace the disk, I guess, but rm in /tmp is sometimes my saviour.

A question vis WebView. Ist it possible to do javascript debugging within the web view? Using WebView from QT webkit I hadn’t been able to find a way to do this.

EDIT: and the question, what version of the SDK? I’m still with the 4.1 version, so possibly, not?

I also have a question to webview:
The documentation tells to add:

 CONFIG += link_pkgconfig
 PKGCONFIG += qt5embedwidget

But most likely I should add something to the .yaml-file, shouldn’t I?
What is the exact syntax and in which section to add it?
Sorry, if the question is that stupid… :flushed:

The lines you mentioned were supposed to be added to the .pro file. Maybe you figured that already out yourself.

In the .yaml -file, you should add qt5embedwidget to the PkgConfigBR section. So in total your PkgConfigBR section could look something like:

  - sailfishapp >= 1.0.2
  - Qt5Core
  - Qt5Qml
  - Qt5Quick
  - qt5embedwidget

We should probably add that to the documentation if it’s not already there.


Ah, yes, the .pro file. No, I didn’t thought about that. Thanks for the Hint. Also the part for the .yaml-file is not yet in the docu as far as i can see. Thanks for the Help!

Actually, now I also notice that the text in the documentation is slightly wrong: You probably shouldn’t add CONFIG += link_pkgconfig in the .pro file, but use CONFIG += sailfishapp instead. I actually fixed that in the documentation already, but the corrected documentation is not yet on the website :confused:


But PKGCONFIG += qt5embedwidget is still needed in the .pro-file, even with qt5embedwidget in the .yaml, right?

CONFIG += sailfishapp seems to be already in the SDKs standard project configuration. :+1:

That is a correct assumption :slight_smile:

1 Like

To answer my own question, no, the 3.6 version of the SDK is needed.

That shouldn’t really be the case. You should be able to use the SDK 3.5 with the EA targets as well. But well, SDK 3.6 is already in Early Access, so yeah, you can use that as well.

I’ll try an Early access target 4.2. from 3.5. I hadn’t had those installed (just got 4.2 running on Volla last week). Might help me get a couple of modern html apps into the store! Thanks!

EDIT: Errr, silly question, I’ve always avoided early access on the phone, in the developer settings. How do I set it up as a developer without touching the phone?

Ok. So I installed and managed to get everything compiled. QT creator says ‘QML module not found (Sailfish.WebView).’ but if I build and send to phone it just works ™. And the app in question, which does not work with the old QTWebView does work with the new! Progress. New apps coming right up…


This depends on exactly what you mean by debugging. You can view the javascript console output in the device console log by setting EMBED_CONSOLE=1, just as with the browser. Or did you mean something more interactive?

1 Like

I can’t seem to make pixelRatio do anything.

I have this inside the WebViewPage:

            Component.onCompleted: {
                WebEngineSettings.pixelRatio = 5

…but web pages look the same as if the setting wasn’t there. Any idea what i might have done wrong?

Also; the link to MDN at the bottom of this page seems to be dead.

Ok, that’s cool. That wasn’t possible with the QT WebView we had till now.

And here is an app demonstrating the new WebView component: