QML Qt openUrlExternally

一个人想着一个人 提交于 2019-12-23 07:46:30

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/5960192/qml-qt-openurlexternally

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!