QDesktopServices::openUrl() not working if app closes
-
Hello! I am making an app similar to the Window 7 Run Dialog. For that, the file/folder/website/other is opened and the window closes.
I have noticed that opening the file/folder/website via QDesktopServices::openUrl() works fine until I want to close the application immediately after. If I do that, the item to open is never opened. I thought this was an issue with the application portal (which may open for some file types), as I have found that is attached to my app's process for whatever reason. However, even with file types with default applications, they don't open if the app is closed after calling openUrl().
Is there anything I can do about this, such as waiting for the portal/process to properly start before closing the app? Thanks
-
Hi,
Which OS are you on ?
Which Qt version are you using ?Note, as the QDesktopServices details show, there's no guarantee that the application starts.
-
Qt v6.12.0-4, Linux (EndeavourOS, KDE Plasma)
I've looked at possibly using QProcess::startDetached() instead, but I don't know if that would open a file/folder/website with its default app in an easy cross-platform way