[Development] Moving QDesktopServices from Gui to Core?

Lars Knoll lars at knoll.priv.no
Tue May 7 19:50:09 CEST 2024



> On 7 May 2024, at 19:15, Thiago Macieira <thiago.macieira at intel.com> wrote:
> 
> On Tuesday 7 May 2024 10:03:21 GMT-7 Thiago Macieira wrote:
>> So I want to know of a use-case where all of the following are true:
>> * application is GUI-less (i.e., is a background service)
>> * application has no GUI counterpart
>> * application is definitely running in a GUI environment

One example I’ve seen are installation scripts that you run from the command line that need some permissions and launch a browser to get them. Pretty much the OAuth case mentioned here.
> 
> Rethinking a little here, if we drill d own one level it may make sense. 
> Replace "application" with "library":
> 
> One may want to make a library that has no GUI dependency and implements some 
> network service. Therefore, they don't want to link to QtGui for 
> QDesktopServices. If the functionality is in QtCore, then they could request 
> the browser if the application is GUI.
> 
> The problem is that said library needs a fallback if the application is *not* 
> GUI. Moreover, I'd question the automatic launching of a browser as part of 
> this library's behaviour. A better design would be for it to emit a signal 
> indicating it requires something to happen and then to let the application or 
> a wrapping library to make a policy decision on what to do.

There could also be use cases where you have split your app into two parts, a UI running in one process and a backend running in another one. The backend doesn’t link against any GUI libraries, but might need to launch an OAuth flow in response to something that’s been triggered by the UI. And there could be many reasons why you’d want a process separation, security being one of them.

So I do believe there are valid use cases for opening a browser window from a process that does not link against a GUI library. Given that the implementation doesn’t require anything UI specific neither I don’t see why we shouldn’t have it in Qt Core.

Cheers,
Lars

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240507/caa3bc65/attachment.htm>


More information about the Development mailing list