QT adds the program icon and window icon, and qt adds the icon window

Source: Internet
Author: User

QT adds the program icon and window icon, and qt adds the icon window
Program icon material preparation

Icon file: *. ico file, which is stored in the same directory as the source file, for example, "myapp. ico"

    

Write icon

Write "RC_ICONS = *. ico" into an independent row in the *. pro file, such as RC_ICONS = "myapp. ico"

     

Generate a program

Run the program to view the software with icons under the program directory.

    

PS: there is also a method to use rc files. I wrote a blog post which is quite detailed. It is no longer cumbersome here. Refer to Qt notes-set the Qt application icon in three steps.

To add more program icons, enter "Setting the Application Icon" in the help box"

Window icon material preparation

Icon file: A common image file can be stored in the same directory of the source file or in a new folder.

    

Generate a QRC File

Right-click the project and select "add New... ", in the new window, select" QT-> Qt Resource File-> Choose... ", enter the file name (random), next, and finish.

    

    

    

  

Import images

Right-click the generated qrc File, select "Open in Editor", add Prefix (any name), add File, and select the image File.

    

    

Set window icon

Edit the ui file in the window, find the "wicon" Property in the property bar, select "Choose Resource...", and find the icon to be used in the new window.

    

Running to see the effect

    

 

Blog posts are for reference only. For more information, please advise.

References:

  Qt notes-set the Qt application icon in three steps

QT program icon and window icon

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.