2015-04-05
展开全部
void ScrollArea::set_image(char *filename)
{
QImage *ppm = new QImage(filename);
label = new QLabel();
printf("ppm->width()=%d, ppm->height()=%d\n",ppm->width(), ppm->height()); //获取图片的宽度和高度
label->setPixmap(QPixmap::fromImage(*ppm));
this->setWidget(label);
/*设置窗口最大高度和宽度为1024*768*/
this->setMaximumHeight(768);
this->setMaximumWidth(1024);
this->resize(QSize( ppm->width()+5, ppm->height() +5));
return;
}
{
QImage *ppm = new QImage(filename);
label = new QLabel();
printf("ppm->width()=%d, ppm->height()=%d\n",ppm->width(), ppm->height()); //获取图片的宽度和高度
label->setPixmap(QPixmap::fromImage(*ppm));
this->setWidget(label);
/*设置窗口最大高度和宽度为1024*768*/
this->setMaximumHeight(768);
this->setMaximumWidth(1024);
this->resize(QSize( ppm->width()+5, ppm->height() +5));
return;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询