1. 程式人生 > >Qt QPixmap設置圖片

Qt QPixmap設置圖片

images ima mage pst bool gre class tran test

/*
    函數名:setPixmap()
    參  數:無
    描  述:設置狀態圖片
*/
void test::setPixmap(bool pixmapStatus)
{
    if(pixmapStatus)
    {
        QPixmap *pixmap = new QPixmap(":/images/red_stone.png");
        ui->label_Pixmap->setPixmap(pixmap->scaled(QSize(12,12),
                                          Qt::IgnoreAspectRatio,
                                          Qt::SmoothTransformation));
    }
else { QPixmap *pixmap = new QPixmap(":/images/green_stone.png"); ui->label_Pixmap->setPixmap(pixmap->scaled(QSize(12,12), Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); } }

Qt QPixmap設置圖片