QImage *img;
img = new QImage (100, 100, QImage::Format_RGB32);
QPainter painter(img);
QBrush brush(Qt::blue,Qt::SolidPattern);
painter.setBackground(brush);
painter.eraseRect(QRect(0,0,100,100));
QRect rect (2,2,96,96);
QPen pen(Qt::red, 3, Qt::DashDotDotLine);
painter.setPen(pen);
painter.drawRoundedRect(rect,4,4);
rect.moveTopLeft(QPoint(10,10));
painter.drawText(rect,"Probando");
QString line;
for (int y=0; y< 20; y++) {
for (int x=0; x< 20; x++){
int red = QColor(img->pixel(QPoint(x,y))).red();
int green = QColor(img->pixel(QPoint(x,y))).green();
int blue = QColor(img->pixel(QPoint(x,y))).blue();
line = line +"(" + QString::number(red) + "," +
QString::number(green)+ "," +
QString::number(blue)+ ") ";
}
qDebug() << line;
line = "";
}
ui->label->setPixmap(QPixmap::fromImage(*img));