天天看點

怎樣通過QSS設定ICON

在網上找了許久,也測試了不少的方法,終于找到可以設定QPushButton ICON的方法。很完美的将圖示設定到左邊。

#CUserWidget #teacherPbt{

    qproperty-icon: url(data/images/userMangaer/teacher.png);

}

怎樣通過QSS設定ICON

最終實作方式為:

#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;

進行過修改,不過太麻煩了。

繼續閱讀