Qt QPixmap设置图片

/*
    函数名: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));
    }
}

 

posted on 2018-06-01 22:06  jiangsion  阅读(8972)  评论(0编辑  收藏  举报

导航