Can somebody please tell me if the image can be displayed as it is in chips program.Here image is displayed as chips instead of the original image.After doing zoom-out the original image appears.The chip program's path is:\Qt\4.4.3\demos\chip.The code is :
void MainWindow::populateScene()
{
scene = new QGraphicsScene;
QImage image(":/img_2.png");
// Populate scene
int xx = 0;
int nitems = 0;
for ([color=blue]int i = -11000; i < 11000; i += 110) {
++xx;
int yy = 0;
for (int j = -7000; j < 7000; j += 70) {
++yy;
qreal x = (i + 11000) / 22000.0;
qreal y = (j + 7000) / 14000.0;
QColor color (image.pixel (int (image.width () * x), int (image.height () * y)));
QGraphicsItem *item = new Chip(color, xx, yy);
item->setPos(QPointF(i, j));
scene->addItem(item);
++nitems;
}
}
}
Bookmarks