QLineEdit设置icon

 

QLineEdit {
    background: #f3f3f3;
    background-image: url(:Images/search.svg); /* actual size, e.g. 16x16 */
    background-repeat: no-repeat;
    background-position: left;
    color: #252424;
    font-family: SegoeUI;
    font-size: 12px;
    padding: 2 2 2 20; /* left padding (last number) must be more than the icon's width */
border: 1px solid #dddddd; }
ps:注意要设置
border: 1px solid #dddddd;不然会出现背景图标闪烁(应该是qt的bug,也许高版本已经修复)
posted @ 2020-10-23 10:44  beautifulday  阅读(1407)  评论(0)    收藏  举报