Unsolved PDF open problem
-
@f.lerdino
What Qt is it ?
Sounds like QDesktopServices broke with update then.
( not QDesktopServices faults but something changed in the system) -
@mrjj
The final error reads:xdg-open: no method available for opening '/home/labotdd/doc3.pdf'
I don't see how
QDesktopServices
per se can be blamed for that?@f-lerdino
There are mentions of "root" in the trace. Just to check: you have no root-ness going on when you run the Qt app vs when you do it outside of Qt?I also tried to use xdg-open mypdf.pdf and the pdf file has been opened
Please try with
xdg-open /home/labotdd/doc3.pdf
Also, FWIW, can you try from your Qt app with something other than a
.pdf
, if your code allows it? -
for mrjj : I have 5.11.1 and ubuntu 16.04 -kernel 4.13.0.-45.
for JonB: if I try ro run this 'xdg-open /home/labotdd/doc3.pdf the pdf' the file is opened whitout any problem. -
@JonB said in PDF open problem:
Also, FWIW, can you try from your Qt app with something other than a .pdf, if your code allows it?
I have tried with a txt file and with it works....
-
@f.lerdino
Root-ness? Do you have anything root-y going on? By any chance, is your Qt app being run as/by root?Is your Qt app a GUI one or command-line only? Are you running Unity or not/other?
-
Hi
Also could you list what
xdg-mime query default application/pdf
returns ? -
@mrjj said in PDF open problem:
xdg-mime query default application/pdf
labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
evince.desktop -
Ok. so that is not changed.
if u type evince in a shell ( normal user) it starts as normally ? -
@f.lerdino
I really think this could be a root issue, which you have not answered. If I deliberately gosudo xdg-open .....pdf
I get messages like I see in yours:
No protocol specified Unable to init server: Could not connect: Connection refused Cannot parse arguments: Cannot open display: No protocol specified Unable to init server: Could not connect: Connection refused Cannot parse arguments: Cannot open display: Warning: program returned non-zero exit code #1
-
@f.lerdino
I think this is not a Qt issue per se, but an Ubuntu 16.04 one. Try Googling for something likeubuntu 16.04 xdg-open
. I think https://askubuntu.com/questions/779717/xdg-open-stopped-working-since-16-04-upgrade might be where you'll find what you need to do... ? -
@mrjj
I have an old version of ubuntu and everything work. Something is changed after the ubuntu update. Of course I run my QT Program as root. -
@f.lerdino
The link @JonB gives , suggest that
gvfs-info being deprecated.
so that might be your actual issue.
(some posts down) -
@JonB
I use root to run my Qt program -
@f.lerdino
but does it work then if u dont run as root ? -
I use root to run my Qt program
Scary. Which is why I asked earlier.
Given that the error messages you show are complaining as not being able to do stuff as root, I presume when you tested running the
xdg-open
s and said they worked you did so as root too? -
@JonB said in PDF open problem:
Given that the error messages you show are complaining as not being able to do stuff as root, I presume when you tested running the xdg-opens and said they worked you did so as root too?
Yes I have tried as root...
-
Can I run as external program the pdf viewer + mypdffile in QT/Ubuntu?
Thanks
-
@f.lerdino
Well you could run it via QProcess. -
I have the same problem and it seems like the problem is caused by this firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?format=default&id=1323302
(and the resulting change: https://hg.mozilla.org/mozilla-central/rev/90a06cdcb48f)It seems like xdg-open uses firefox in background to display the PDF files.
Unfortunately it seems like the firefox team has not provided a possibility to bypass this behavior.
(Chrome Browser for example provides "--no-sandbox" option to start it as root in a non-root user session)