void ImageProcess::grayscale()
{dst=*image;
int width = image->width();
int height = image->height();
for (int h=0;h<height;h++)
{
for (int w=0;w<width;w++)
{
int r = qRed(image->pixel(w,h));
int g = qGreen(image->pixel(w,h));
int b = qBlue(image->pixel(w,h));
int n=int(0.299*r+0.587*g+0.114*b+0.5);
dst.setPixel(w,h,qRgb(n,n,n));
}
}
resize(dst.width(),dst.height());
repaint();
}
void ImageProcess::paintEvent(QPaintEvent * e)
{
QPainter painter(this);
painter.drawImage(0,0,dst);
}加上这个还是不响应啊