怎样通过QSS设置ICON

您所在的位置:网站首页 qt设置按钮图片位置不同 怎样通过QSS设置ICON

怎样通过QSS设置ICON

2024-07-02 20:57| 来源: 网络整理| 查看: 265

在网上找了许久,也测试了不少的方法,终于找到可以设置QPushButton ICON的方法。很完美的将图标设置到左边。

#CUserWidget #teacherPbt{     qproperty-icon: url(data/images/userMangaer/teacher.png); }

 

最终实现方式为:

#CUserWidget #teacherPbt{     qproperty-icon: url(data/images/userMangaer/teacher.png) off, url(data/images/userMangaer/teacher-focus.png) on;

    qproperty-iconSize: 20px 20px; }

可以实现图标的变换。

 

 

曾通过这种方法:

    image:url(data/images/userMangaer/teacher.png);     image-position:0px left;

进行过修改,不过太麻烦了。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3