[Interest] how to add the Application icon to the file which is generated from my Qt Application..... so that saved file shows the Application icon image ??????

Jaco Naude naude.jaco at gmail.com
Thu Jan 19 06:43:40 CET 2012


Hi Muthulingam

Do you mean your executable? In that case see
http://doc.qt.nokia.com/4.7-snapshot/appicon.html.

If you mean that you want to associate a specific file type with your
application it becomes more difficult and it depends on the OS where you
deploy your application.
I have only done this on Windows and there is probably many ways to do it
(and this is not really a Qt question), but here is my solution:

I create my installers using NSIS and adding the following to the installer
script will create a file association windows (Tested on XP,Vista,7):

;--------------------------------
; File Associations
;--------------------------------
; Write a file association to the registry for files with extension
.yourextension files:
WriteRegStr HKCR ".yourextension" "" "YourApplication.FileDescription"
WriteRegStr HKCR "YourApplication.FileDescription" "" \
"Your Application FileDescription"
WriteRegStr HKCR "YourApplication.FileDescription\DefaultIcon" "" \
"$INSTDIR\YourApplication.exe,0"
WriteRegStr HKCR "YourApplication.FileDescription\shell\open\command" "" \
'"$INSTDIR\YourApplication.exe" "-i" "%1"'
WriteRegStr HKCR "YourApplication.FileDescription\shell\print\command" "" \
'"$INSTDIR\YourApplication.exe" /p "-i" "%1"'

You then need to handle a command line parameter which you will receive
from windows when someone opens your file. In the above example it will
look something like this:
YourApplication.exe -i "File Path"

Hope it helps,
Cheers
Jaco



On Thu, Jan 19, 2012 at 7:21 AM, Muthulingam Ammaiappan <
muthulingam.a at gmail.com> wrote:

> Hi Friends,
>
> I wanted to add the Application Icon image to the file which is generated
> from my Qt Application....
>
> so that the saved file should display the Application Icon Image.....
>
> (for example: PDF files shows the Adobe Reader Application Icon....)...
>
> can anyone help me to fix this problem????
>
> Thanks & Regards,
> Muthulingam
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>


-- 
Jaco Naude'

Qtilities: Building blocks for Qt applications.
http://www.qtilities.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120119/ade9d13b/attachment.html>


More information about the Interest mailing list