Solved Images are not loaded when application starts through .desktop file.
-
I have tried it on multiple Linux distributions and here is how it goes.
Case 1:
I start from menu or .desktop file than all images are not loaded.
Case 2:
I run directly from binary, everything get's loaded correctly.Any ideeas why?
Qt version: 5.9.2, Linux distributions tested on: Ubuntu 16.04.3, Linux Deepin, Ubuntu 17.10, KDE Neon.
Arhitecture: 64 bit on all platforms. -
What images are you talking about?
-
@Wieland said in Images are not loaded when application starts through .desktop file.:
What images are you talking about?
PNG format images loaded through Image QML type inside the application.
Here is the entry of the desktop file:
[Desktop Entry] Type=Application Terminal=false Categories=Utility; Exec=/home/adi/Programe/Cumulus/Cumulus Name=Cumulus Icon=/home/adi/Programe/Cumulus/icons/hicolor/512x512/cumulus.png
-
Maybe you forgot to deploy the images? Or are they compiled into a Qt resource file? Did you check at run-time if the images' filepaths are valid?
-
@adutzu89
Are the image files specified by absolute path or relative path? Does the "run directly from binary" (presumably from shell terminal) still work if you first do acd /tmp
? -
@Wieland said in Images are not loaded when application starts through .desktop file.:
Maybe you forgot to deploy the images? Or are they compiled into a Qt resource file? Did you check at run-time if the images' filepaths are valid?
The images are deployed and are not in Qt resource, like I mentioned before: If I run the binary directly(a.k.a. double-click / click+enter) or by command line, than the images are loaded.
They are not loaded when the application start through .desktop file. -
@JNBarchan
Are the image files specified by absolute path or relative path?
It is relative:
QString prefix = "file:icons/hicolor/512x512/";
I will try tommorrow and let you know if this is the cause(which at first glance seems most likely).
-
@JNBarchan
Setting absolute path worked, thank you for your help.