1.设置切割属性:将图片切割为 n*m 个图片
2.计算每个图片的rect,保存为rect列表
3.利用copy(Rect)函数将指定区域图片copy出来,存储到切割列表中
QImageimage::iamgeItems(intx, inty) { intwidth=image.width(); intheight=image.height(); intcellWidth=width/x; intcellHeight=height/y; qDebug() <<width<<" "<<height<<" "<<cellWidth<<" "<<cellHeight; for(inti=0 ;i<x; i++ ) { for (intj=0; j<y; j++) { QRectrect(i*cellWidth,j*cellHeight, cellWidth,cellHeight); qDebug() <<rect.x() <<" "<<rect.y() <<" "<<rect.width() <<" "<<rect.height(); returnimage.copy(rect); } } }