Re: QDesktopServices.setUrlHandler not called on OS X

Florian Bruhin <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
Hi,

On Sun, Jul 07, 2019 at 01:12:22PM +0200, Marko Luther wrote:
> Now it seems to me that the 
> 
> > QDesktopServices.setUrlHandler
> 
> is doing nothing, at least on Mac OS X and Windows.
> 
> Windows seems not to be able to send even the event to an already running
> instance of the app that got registered via the corresponding registry
> entries. Instead it starts a new instance of the app and hands the URL over
> via sys.args. Strange.
> 
> Is nobody using URL schemes?

QDesktopServices.setUrlHandler probably doesn't do what you think it does. It
only affects URLs opened via QDesktopServices.openUrl in Qt.

From its docs:

    This function provides a way to customize the behavior of openUrl(). If
    openUrl() is called with a URL with the specified scheme then the given method
    on the receiver object is called instead of QDesktopServices launching an
    external application.

It does talk about recieving data from other apps after that, but that seems to
be iOS-specific.

At least for macOS, you'll need to mention the scheme in your Info.plist and
get an OpenEvent with that URL. On Windows, indeed you get the URL as an
argument. What applications do typically is communicating with the existing
instance via IPC and then quitting the new instance.

Florian

-- 
https://www.qutebrowser.org | [email protected] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE4E5WAAJAG47w528KkW6wyP1VoHIFAl0h2RkACgkQkW6wyP1V
oHJq+xAAluMY+Pzxhanmw7lV9zJa8dcybzTLZxELIDzk6xa5KMHGZx68dYz503Dd
nH8ecIVvRYx3JN2pyXyXfWNQElQD02HMBpOQSVbxIdRbhFx2NmiHGeRerTcL6JIj
w8KrT3qRwKrwpeKCeaIfUWnXiKIunhr1jYLNY6wDNEIhcTFwjg5pK9g9k73Ucje/
35Xd1xMloDRQfRqwF0v5O4nc533raq1grE4vVojP6vz4hDSjCNpyQXDbtLQxtP1w
u1421tAkBLBawQ7g/yyWQ3fvFQCOsaP6ROvN7clEHDVjOinGnU5KW7jbPJ3dRJg6
GJMFx5X7cUpSu9w6TgdsiIesA0hB4tv3vQZ9C0A0dhFWjho/h9L9oO3kudWMmR9q
odkVmsdwFoeKah3XLRfkH9WOPu9OLBkFneQDLfKWIynqn5opf3/TwupY85Owt1iI
g4dRBUcwjhHPg3hL9tqfHyjSLMHSR+LkGIultoAklUxJyfFxzvuVihqdETSqtCD3
NH0Ekg1HLZCj4YlYj7Zt0MEG60i9eGQ0WAMv5HUPy8yj+HYFzak7CX8Fdd4QuYsP
yG0UF8ZY+pW4b0y6Ag0ilp3UwtWVhBN7u1rXmUDYQW7G+mUlnoW0+81XZO5yQ4wP
cfOIqLGcQLprA0+gHPKwpvhVRwEYifgwdCv9Dxe45HOUHMLHqDA=
=LT/J
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.