I call a derived class GLGraph3D_fxy:
class Graph3D_Base_GLWidget
: public QGLWidget{
Q_OBJECT
public:
Graph3D_Base_GLWidget();
~Graph3D_Base_GLWidget();
void initializeGL();
virtual void paintGL();
void axis3D();
void resizeGL(int width, int height);
void AutoRotate();
bool event
(QEvent *event
);
//function causing the problem ...
};
class GLGraph3D_fxy : public Graph3D_Base_GLWidget
{
Q_OBJECT
public:
GLGraph3D_fxy();
~GLGraph3D_fxy();
virtual void paintGL();
...
...
};
....
bool Graph3D_Base_GLWidget
::event(QEvent *event
) {
if (event
->type
() == QEvent::WindowDeactivate) {
if (TimerRotate != 0)
{
killTimer(TimerRotate);
TimerRotate = 0;
}
return true;
}
}
class Graph3D_Base_GLWidget : public QGLWidget
{
Q_OBJECT
public:
Graph3D_Base_GLWidget();
~Graph3D_Base_GLWidget();
void initializeGL();
virtual void paintGL();
void axis3D();
void resizeGL(int width, int height);
void AutoRotate();
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent (QMouseEvent * event);
void mouseMoveEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent * event );
bool event(QEvent *event); //function causing the problem
void keyPressEvent(QKeyEvent *event);
void timerEvent(QTimerEvent *event);
...
};
class GLGraph3D_fxy : public Graph3D_Base_GLWidget
{
Q_OBJECT
public:
GLGraph3D_fxy();
~GLGraph3D_fxy();
virtual void paintGL();
...
void contextMenuEvent(QContextMenuEvent * event ) ;
...
};
....
bool Graph3D_Base_GLWidget::event(QEvent *event)
{
if (event->type() == QEvent::WindowDeactivate)
{
if (TimerRotate != 0)
{
killTimer(TimerRotate);
TimerRotate = 0;
}
return true;
}
return QWidget::event(event);
}
To copy to clipboard, switch view to plain text mode
I also just notice if I resize the blank window it will turn black and display the graphs correctly. I'm guessing I have some broken code, or some initialization issue, but it puzzles me that it works good on windows and linux
Bookmarks