summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorartoka <arto.katajasalo@digia.com>2011-11-01 12:47:17 (GMT)
committerCasper van Donderen <casper.vandonderen@nokia.com>2011-11-01 13:10:49 (GMT)
commite71c2a6d13e079e9e4d7a8446f2ef4c6958b18f8 (patch)
tree3fc1520e1548b16de3866fd7a9dfca20b2f6c8de /doc/src/snippets
parent09c2405c1da26156f1aa37e2ff341fea4552c2e3 (diff)
downloadQt-e71c2a6d13e079e9e4d7a8446f2ef4c6958b18f8.zip
Qt-e71c2a6d13e079e9e4d7a8446f2ef4c6958b18f8.tar.gz
Qt-e71c2a6d13e079e9e4d7a8446f2ef4c6958b18f8.tar.bz2
QGLColormap example was invalid
QGLColormap example missed int argc and char *argv[] from main - method. Filling the QGLColormap with for - loop was not working because of the 0 - size. Added arguments to main - method and changed the filling so that for-loop uses size of 256. Task-number: QTBUG-3563 Merge-request: 2698 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/code/src_opengl_qglcolormap.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/doc/src/snippets/code/src_opengl_qglcolormap.cpp b/doc/src/snippets/code/src_opengl_qglcolormap.cpp
index 3bd780b..535777d 100644
--- a/doc/src/snippets/code/src_opengl_qglcolormap.cpp
+++ b/doc/src/snippets/code/src_opengl_qglcolormap.cpp
@@ -42,7 +42,7 @@
#include <QApplication>
#include <QGLColormap>
-int main()
+int main(int argc, char *argv[])
{
QApplication app(argc, argv);
@@ -51,7 +51,8 @@ int main()
// This will fill the colormap with colors ranging from
// black to white.
- for (int i = 0; i < colormap.size(); i++)
+ const int size = 256;
+ for (int i = 0; i < size; ++i)
colormap.setEntry(i, qRgb(i, i, i));
widget.setColormap(colormap);