Problem with 'm_backgroundColor' in a QGraphicsScene's subclass
Hi!
I'm trying to do a subclass of QGraphicsScene to draw a OpenGL scene into a QT's widget and when I compile this it give me the follow error:
'm_backgroundColor' was not declared in this scope
I am looking for the problem and I don't find it.
Please, I hope someone can help me.
I'm using KDevelop 3.5.10 and QT4
This is my code:
Code:
//************************
// openglscene.h
//************************
#ifndef OPENGLSCENE_H
#define OPENGLSCENE_H
#include <QtCore/QString>
#include <QtCore/QTimer>
#include <QtGui/QKeyEvent>
#include <QtGui/QApplication>
#include <QtOpenGL/QGLWidget>
#include <QtGui/QMainWindow>
#include <QtGui/QMdiSubWindow>
#include <QtGui/QMdiArea>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QTextCursor>
#include <QDialog>
#include <QKeyEvent>
#include <QFile>
#include <QTextStream>
#include <QMessageBox>
#include <QMenu>
#include <QTextDocumentFragment>
#include <QScrollBar>
#include <QPainter>
#include <QDebug>
#include <QListWidget>
#include <QProcess>
#include <QClipboard>
#include <QFileInfo>
#include <QPrintDialog>
#include <QTime>
#include <QTextLayout>
#include <QTextCodec>
#include <QDir>
#include <QPaintEngine>
#include <QColormap>
#include <QtCore>
#include <QtGui>
#include <QtOpenGL>
using namespace std;
public:
OpenGLScene();
protected:
};
#endif
//************************
// openglscene.cpp
//************************
#include "openglscene.h"
OpenGLScene:penGLScene(){}
void OpenGLScene
::drawBackground ( QPainter *painter,
const QRectF & ){ if ( painter
->paintEngine
()->type
() != QPaintEngine:penGL
){ qWarning ( "OpenGLScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view" );
return;
}
glClearColor( m_backgroundColor.redF(), m_backgroundColor.greenF(), m_backgroundColor.blueF(), 1.0f );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
Re: Problem with 'm_backgroundColor' in a QGraphicsScene's subclass
There is no m_backgroundColor variable in your class, is there?