Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDesktopServices::openUrl() not working if app closes
Qt 6.12 LTS is out! See what's new in the release blog

QDesktopServices::openUrl() not working if app closes

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 59 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jayrickaby
    wrote last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jayrickaby
        wrote last edited by
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved