Results 1 to 4 of 4

Thread: Applications Properties and Icon

  1. #1
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Applications Properties and Icon

    Build Environment: Qt 5.0.2, Qt Creator 2.7.0, MinGW 4.7, Windows 7 32-bit.

    I'm trying to get both Application properties and Application ICON set.
    If I create a file called logo.rc that contains:
    Qt Code:
    1. IDI_ICON1 ICON DISCARDABLE "images/Application.ico
    To copy to clipboard, switch view to plain text mode 

    and add the following line to my .pro file:
    Qt Code:
    1. RC_FILE=logo.rc
    To copy to clipboard, switch view to plain text mode 

    Then the logo gets set. But when I include these lines in the .pro:
    Qt Code:
    1. QMAKE_TARGET_COMPANY = "MyCo Inc."
    2. QMAKE_TARGET_PRODUCT = "myPRODUCT"
    3. QMAKE_TARGET_DESCRIPTION = "myPRODUCT rules."
    4. QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2013 MyCo, Inc"
    To copy to clipboard, switch view to plain text mode 

    The property values are NOT set.

    If I remove the RC_FILE setting from the project, then the property values are set and a file named "<project>_resource.rc" is created in the project directory. Then the property values are set.

    It seems I'm allowed only one .rc file per project. Is there a way to set both the Application ICON and the Application Properties or can I only set one or the other?

    Karl

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,734
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Applications Properties and Icon

    If you want to set the details that Windows displays in Windows Explorer then that all goes in the Windows resource file VERSIONINFO block.
    http://stackoverflow.com/questions/2...ion-info-in-qt

    I have no idea where this QMAKE_TARGET_* variables idea came from. They are not documented anywhere I have seen.

  3. #3
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Applications Properties and Icon

    Actually, I found them at the bottom of the very StackOverflow post you suggested. I've never seen them documented either, but they do work. They just seem to tell qmake to create the .rc file described at the top of that post. Nice and convenient for a programmer used to doing things in UNIX and not worrying about such features. The problem is the .rc file is stomped on every time qmake runs.

    I was hoping someone knew of another undocumented variable that might add the ICON to the same .rc file or some other trick that might let me do both the ICON and still use the magic variables.

    The full code I stole from that StackOverflow post looks like this:
    Qt Code:
    1. TARGET = myAPP
    2. VERSION = 1.0.0.3
    3.  
    4. QMAKE_TARGET_COMPANY = "MyCo Inc."
    5. QMAKE_TARGET_PRODUCT = "myPRODUCT"
    6. QMAKE_TARGET_DESCRIPTION = "myPRODUCT rules."
    7. QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2013 MyCo, Inc"
    8.  
    9. DEFINES += \
    10. APP_VERSION=\"\\\"$$VERSION\\\"\" \
    11. APP_COMPANY=\"\\\"$$QMAKE_TARGET_COMPANY\\\"\" \
    12. APP_PRODUCT=\"\\\"$$QMAKE_TARGET_PRODUCT\\\"\" \
    13. APP_DESCRIPTION=\"\\\"$$QMAKE_TARGET_DESCRIPTION\\\"\" \
    14. APP_COPYRIGHT=\"\\\"$$QMAKE_TARGET_COPYRIGHT\\\"\" \
    15. APP_NAME=\\\"$$TARGET\\\"
    To copy to clipboard, switch view to plain text mode 

    That lets me do all kinds of fun things with the values in the application. I'll submit a case to Digia and see if they have any suggestions.

    Karl

  4. #4
    Join Date
    Apr 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Applications Properties and Icon

    If you add this to the .pro file:

    RC_ICONS = "images/Application.ico"

    and remove the RC_FILE altogether, then both properties and icon should work.

Similar Threads

  1. How to get installed applications icon in Nokia N9
    By proj_symbian in forum Qt Quick
    Replies: 1
    Last Post: 19th April 2012, 07:07
  2. Creating a list with icon and text in the center of icon
    By prophet0 in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2011, 03:03
  3. Replies: 0
    Last Post: 17th March 2010, 13:25
  4. Replies: 2
    Last Post: 12th October 2008, 14:42
  5. Couple of questions: main window icon + toolbar icon
    By bpackard in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 19:03

Tags for this Thread

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.