Results 1 to 5 of 5

Thread: How to assign an icon to a file type of a Qt program using a script file

  1. #1
    Join Date
    Jan 2016
    Posts
    76
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows Android

    Default How to assign an icon to a file type of a Qt program using a script file

    Hi guys,

    I've been said it's a simple issue, and I myself too think so because there are many Windows programs published daily to the marked all have that ability and a good part of that programs are based on C++ or created by Qt.
    Here is the source file and I use Qt Installer Framework with this script file for making an installer:


    Qt Code:
    1. function Component(){ }
    2.  
    3. Component.prototype.createOperations = function()
    4. {
    5. component.createOperations();
    6. if (installer.value("os") == "win")
    7. {
    8. var userProfile = installer.environmentVariable("USERPROFILE");
    9. installer.setValue("UserProfile", userProfile);
    10.  
    11. component.addOperation("CreateShortcut", "@TargetDir@/Spreadsheet.exe",
    12. "@UserProfile@/Desktop/Spreadsheet.lnk" ,"workingDirectory=@TargetDir@",
    13. "iconPath=@TargetDir@/Spreadsheet.ico");
    14.  
    15. component.addOperation("CreateShortcut", "@TargetDir@/QSpreadsheet.exe",
    16. "@TargetDir@/Spreadsheet.lnk" ,"workingDirectory=@TargetDir@",
    17. "iconPath=@TargetDir@/Spreadsheet.ico");
    18.  
    19. component.addOperation("CreateShortcut", "@TargetDir@/Spreadsheet.exe",
    20. "@StartMenuDir@/Spreadsheet.lnk", "workingDirectory=@TargetDir@",
    21. "iconPath=@TargetDir@/Spreadsheet.ico");
    22.  
    23. component.addOperation("RegisterFileType", "sp",
    24. "@TargetDir@\\Spreadsheet.exe \" %1\"", "Tomy Files", "application/Tomy",
    25. "@TargetDir@/Spreadsheet.ico", "ProgId=Spreadsheet.sp")
    26. }
    27. }
    To copy to clipboard, switch view to plain text mode 


    I've been said using that script file and Qt Installer Framework I can have the job done. But when I make the installer this way, no icon will be set on the file type of the program.
    Does anybody know what the problem is please?

  2. #2
    Join Date
    Jan 2016
    Posts
    76
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How to assign an icon to a file type of a Qt program using a script file

    No opinion!?

  3. #3
    Join Date
    Sep 2017
    Posts
    29
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: How to assign an icon to a file type of a Qt program using a script file

    Quote Originally Posted by franky View Post
    No opinion!?
    The Qt community is like that it seems. I just joined this forum too but very unhelpful.
    if i know about your problem, ill surely help you. but, i myself is a newbie.
    good luuck man.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to assign an icon to a file type of a Qt program using a script file

    if i know about your problem, ill surely help you.
    Exactly. Think about what you said: "if I could help you, I would".

    Maybe it is the case here that there is no one who follows this forum with the experience needed to help franky with the problem. No one here gets paid for answering questions. Everyone who posts answers here does it because they want to help people who are learning Qt or struggling with certain parts of it, and we do it on our own time, for free.

    The Qt community is like that it seems. I just joined this forum too but very unhelpful.
    The Qt community and this forum are not "like that". This is not a help line where people sit around waiting for questions they get paid to answer. It's a completely volunteer effort, including running the forum itself. No one here is an expert in all things Qt, and no one claims to be. Each of us has areas we are more familiar with and I think all of us have taught ourselves what we know, by reading books, looking at examples and tutorials, writing our own code, asking questions here, and spending lots of time pounding our heads on the wall. Those of us who have answered thousands of questions over 10 years or more are doing it because we know how hard the learning has been, because we like Qt and want to see it grow, and because one way to do that is to help people and encourage them to continue to use Qt.

    Sometimes there are questions that don't get answered. These fall into several categories:

    - no one here knows the answer to the question
    - the question is so vague and confused that no one understands it
    - it is obviously a homework problem, and we don't do your homework for you
    - the question is unrelated to Qt, or
    - the person who knows the answer isn't monitoring the forum at that time

    In answer to one of your questions, I suggested that you teach yourself some basics and I gave you some links to information I thought you might be able to use. You found that to be "unhelpful", and responded by making sarcastic replies to almost every post here for a few days. You've made another criticism here.

    How does that make us feel? Turn it around. If you were trying to help a newbie out, and each time you tried to answer a question you got a sarcastic reply, how often would you do that until you decided that person wasn't worth helping because they didn't appreciate it?

    A community works both ways. Each member gives what he can and is grateful for what he receives. Expecting the community to exist for your needs and criticizing it when your needs aren't met is not what it is all about.

    if i know about your problem, ill surely help you.
    And I hope you will do that as you learn and become more expert in your understanding of Qt.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Jan 2016
    Posts
    76
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How to assign an icon to a file type of a Qt program using a script file

    @d_stranz

    I received two replies from that person and to be frank and honest, found none of them constructive. I tried just to simply ignore them although I need an answer very much. I understand what you say and know how "helpful" forums are. Experts like you dedicate their time helping people they even don't know. It's truly impressive. Thanks for your help.

  6. The following user says thank you to franky for this useful post:

    d_stranz (26th September 2017)

Similar Threads

  1. Replies: 4
    Last Post: 20th September 2017, 18:14
  2. How to get file type Icon ?
    By wirasto in forum Qt Programming
    Replies: 4
    Last Post: 12th July 2010, 13:18
  3. Replies: 5
    Last Post: 5th August 2009, 18:32
  4. change txt file type default icon
    By mismael85 in forum Qt Programming
    Replies: 8
    Last Post: 20th February 2008, 23:22
  5. Associating icon with a file type
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 6th June 2006, 17:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.