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:
Qt Code:
  1. //************************
  2. // openglscene.h
  3. //************************
  4. #ifndef OPENGLSCENE_H
  5. #define OPENGLSCENE_H
  6.  
  7. #include <QtCore/QString>
  8. #include <QtCore/QTimer>
  9. #include <QtGui/QKeyEvent>
  10. #include <QtGui/QApplication>
  11. #include <QtOpenGL/QGLWidget>
  12. #include <QtGui/QMainWindow>
  13. #include <QtGui/QMdiSubWindow>
  14. #include <QtGui/QMdiArea>
  15. #include <QGraphicsView>
  16. #include <QGraphicsScene>
  17. #include <QTextCursor>
  18. #include <QDialog>
  19. #include <QKeyEvent>
  20. #include <QFile>
  21. #include <QTextStream>
  22. #include <QMessageBox>
  23. #include <QMenu>
  24. #include <QTextDocumentFragment>
  25. #include <QScrollBar>
  26. #include <QPainter>
  27. #include <QDebug>
  28. #include <QListWidget>
  29. #include <QProcess>
  30. #include <QClipboard>
  31. #include <QFileInfo>
  32. #include <QPrintDialog>
  33. #include <QTime>
  34. #include <QTextLayout>
  35. #include <QTextCodec>
  36. #include <QDir>
  37. #include <QPaintEngine>
  38. #include <QColormap>
  39. #include <QtCore>
  40. #include <QtGui>
  41. #include <QtOpenGL>
  42.  
  43. using namespace std;
  44.  
  45. class OpenGLScene : public QGraphicsScene{
  46. public:
  47. OpenGLScene();
  48.  
  49. protected:
  50. void drawBackground ( QPainter *painter, const QRectF & );
  51. };
  52. #endif
  53.  
  54. //************************
  55. // openglscene.cpp
  56. //************************
  57. #include "openglscene.h"
  58.  
  59. OpenGLScene:penGLScene(){}
  60.  
  61. void OpenGLScene::drawBackground ( QPainter *painter, const QRectF & ){
  62. if ( painter->paintEngine()->type() != QPaintEngine:penGL ){
  63. qWarning ( "OpenGLScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view" );
  64. return;
  65. }
  66.  
  67. glClearColor( m_backgroundColor.redF(), m_backgroundColor.greenF(), m_backgroundColor.blueF(), 1.0f );
  68. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  69. }
To copy to clipboard, switch view to plain text mode