2

What is used to open urls with QDesktopServices::openUrl(...)?

xdg-open, kopen, selmademachanism or a mix of them? I ask because it fails on a scheme where xdg-open does not.

Edit: okay its getting even more curious: The missing scheme works in debug mode, but not in release mode...

Example code:

#include <QApplication>
#include <QDesktopServices>
#include <QUrl>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QDesktopServices::openUrl(QUrl("tg://resolve?domain=imagebot"));
}
ManuelSchneid3r
  • 15,850
  • 12
  • 65
  • 103
  • Can you give us an example of the failing case? From [source code](https://github.com/qtproject/qtbase/blob/1d8b6597a36f266c3384553365326cf7ec9f8641/src/platformsupport/services/genericunix/qgenericunixservices.cpp#L82) it seems like it is going to use `xdg-open`. – HeyYO Aug 14 '15 at 12:54
  • Updated. This scheme is handled by the telegram messenger. I alway wonder how people are able to read qt source code. I tried but ended in a dead end. – ManuelSchneid3r Aug 14 '15 at 12:56
  • Does your actual application lack an event loop as your example? I suspect that might be the issue. Here is what I've tried so far; added `openUrl` call to a pushbuttons slot, it worked fine. Tried your example, didn't work when run from QtCreator. But it worked when run from bash terminal, strange.. When I added `a.exec()` at the end of `main`, it worked fine again. I'm not an expert but I wouldn't expect a Qt application without a loop to work properly. – HeyYO Aug 14 '15 at 20:21
  • `strace` your app and check what's going on? – peppe Aug 15 '15 at 20:44

0 Answers0