Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-63240

QDesktopServices::openUrl changes the URL

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.9.1
    • GUI: Workspace
    • None
    • Archlinux

    Description

      Sometimes opening files does not work with QDesktopServices.

      In my code I do this
       

      qDebug() << QUrl::fromLocalFile(file_->filePath()).toString();
      QDesktopServices::openUrl(QUrl::fromLocalFile(file_->filePath()));
      

      It it prints

      [16:30:39] [DEBG] "file:///home/manuel/Dropbox/TODO.md"
      

      strace says

      [pid 19725] execve("/usr/bin/xdg-open", ["/usr/bin/xdg-open", "file:Dropbox/TODO.md"], 0x557e8afe1330 /* 50 vars */ <unfinished ...>
      

      Well and when I excute this myself in the shell:

      manuel@argon ~ $ /usr/bin/xdg-open file:Dropbox/TODO.md
      gio: file:Dropbox/TODO.md: Vorgang wird nicht unterstützt
      

      I know gio should be capable of handling relative urls, but also Qt should not change the URL if I pass it an absolute path.

      The funny thing is that when I start open this file with my program running in QtCreator it mysteriously works.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            manuelschneid3r Manuel Schneider
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes