How to use pic in qss
-
I found many software's resouces file were in one picture,like this:
!http://www.youback.net/wp-content/uploads/2014/09/play.png(play.png)!
This is a button's different state of press, hover...and they were designed in one picture.
I can use first or last sub pic by this qss:@
.QPushButton{
background-image: url(:/image/btn-play.png);
background-position:left top;
/background-position:right top;/
width:48px;
height:48px;
}
@The background-position of QSS has no equivalent in CSS2 or CSS3. It has no background-position-x background-position-y.
How to use the second or third in QSS??
-
Hi,
AFAIK, you can't do it from stylesheets. It doesn't yet implement full CSS. But you can do it easily using QPixmap functions. For eg.
@
QPixmap pix(":/play.png");
ui->label->setPixmap(pix.copy(48,0,48,48));
@This will display the image with x-offset of 48px on the QLabel.