# 4 million items, is it really possible?

Someone asked me if it was truly possible to do 4 million items in real time using Graphics View. I challenge you to see for yourselves. Download one of the latest snapshots for Qt 4.2 (one with the 40000 Chips demo in it) - and apply this patch to increase the number of items. It's real-time, you can move items around at practically no CPU-usage, and you can zoom in and out smoothly (when zooming far out it does become slow though).

4 000 000 items. Howz dat? ;-)

```--- mainwindow.cpp  1970-01-01 01:00:00.000000000
+++ mainwindow.cpp  2006/08/25 10:51:09.000000000
@@ -62,13 +62,13 @@
// Populate scene
int xx = 0;
int nitems = 0;
-    for (int i = -11000; i < 11000; i += 110) {
+    for (int i = -110000; i < 110000; i += 110) {
++xx;
int yy = 0;
-        for (int j = -7000; j < 7000; j += 70) {
+        for (int j = -70000; j < 70000; j += 70) {
++yy;
-            qreal x = (i + 11000) / 22000.0;
-            qreal y = (j + 7000) / 14000.0;
+            qreal x = (i + 110000) / 220000.0;
+            qreal y = (j + 70000) / 140000.0;
QColor color(image.pixel(int(image.width() * x), int(image.height() * y)));
QGraphicsItem *item = new Chip(color, xx, yy);
```