10

I've just discovered strange behavior when using this code

Qt.openUrlExternally(someurl); 

I would like to let my users open facebook sharer url, but I cannot use this code, as it does nothing.

Tested on S60 5th and Symbian^3 devices (C5, C7, 5230, N8)

So please tell me (if you know)
1) Is there any BUG about this component/behavior ? (I searched and didn't found anything)
2) How can i make C++ component to do the same thing ?` (If it is solution)

Thanks

Edit
I found example for creating C++ components with methods accessible to QML, right here: http://doc.qt.io/qt-4.8/qt-declarative-cppextensions-referenceexamples-methods-example.html

Final Edit

Discussion led to making a bug report, could be found on : https://bugreports.qt.io/browse/QTBUG-19201

Thanks everybody

MBach
  • 1,647
  • 16
  • 30
Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
  • Marek, I have just encountered this issue in my own code, `Qt.openUrlExternally` seems to not work on any URL containing `?` or `&`. Did you ever find an actual solution to this? – funkybro Aug 08 '11 at 11:50
  • @funkybro: I'm using calls with `?` and `&` without problems, like this `Qt.openUrlExternally(voucher_link+"?voucher=pdf");`, so your problem has to be caused by something else. Try making separate thread for your problem, and you'll see. – Marek Sebera Aug 09 '11 at 08:29

2 Answers2

14

Qt.openUrlExternally("http://www.stackoverflow.com/"); opens the native browser for me.

The only problem I have found with it is, if the browser is already running on the handset (in the background), it will not be brought in to the foreground, and therefore looks as though it has had no effect.

funkybro
  • 8,432
  • 6
  • 39
  • 52
  • Thanks, but it looks like some bug in platform Qt/QML. Most probable this one: http://bugreports.qt.nokia.com/browse/QTBUG-8336 – Marek Sebera May 11 '11 at 12:01
  • That link is dead. Instead visit: http://bugreports.qt-project.org/browse/QTBUG-8336 – rene Apr 30 '14 at 17:10
6

Try adding this to your .pro file

# Needed for bringing browser from background to foreground using QDesktopServices: https://bugreports.qt.io/browse/QTBUG-8336
TARGET.CAPABILITY += SwEvent

And it should bring the browser to the foreground.

MBach
  • 1,647
  • 16
  • 30
pshah
  • 2,052
  • 1
  • 21
  • 40