Wednesday, May 8, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 2104  / 2 Years ago, mon, april 25, 2022, 5:02:25

I'm building a QML application with the Ubuntu SDK. I've figured out how to add an application icon to the .desktop file, but I'm not sure where to add the window icon itself. I've seen code for setting Applicaton.windowIcon with C++, but I'm just using QML/JS. How can I add my icon to the application configuration?


More From » application-development

 Answers
2

Setting the icon in your .desktop file is adding it to your application configuration, so I'm not quite sure what you're asking. As long as the icon is installed with everything else, you should be all set. If you're installing via a click package, a relative file name for the icon in the .desktop file is all you need; otherwise, you may want to use an absolute path.



If you're trying to get the icon set for a program that isn't installed, you can add the desktop file to ~/.local/share/applications/. IIRC, this file won't be immediately detected, but it will be loaded eventually. Logging out and then back in will probably force a refresh.



If you want to adjust the icon programmatically while the application is running, I can't help you. I'd be surprised if you could do that through pure QML, but it might be easy to write a C++ plugin.


[#26891] Monday, April 25, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lassrake

Total Points: 400
Total Questions: 103
Total Answers: 98

Location: Netherlands
Member since Mon, Jun 22, 2020
4 Years ago
;