summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_opengl_qglcolormap.cpp
blob: b47de762f5d87456370b42d0d2b0ecfe391e5281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//! [0]
#include <QApplication>
#include <QGLColormap>

int main()
{
    QApplication app(argc, argv);

    MySuperGLWidget widget;     // a QGLWidget in color-index mode
    QGLColormap colormap;

    // This will fill the colormap with colors ranging from
    // black to white.
    for (int i = 0; i < colormap.size(); i++)
        colormap.setEntry(i, qRgb(i, i, i));

    widget.setColormap(colormap);
    widget.show();
    return app.exec();
}
//! [0]