Hi there,

I'm using customGL widget which derived from QGLWidget. I wanna use QRubberBand on this widget my code like this ;

Qt Code:
  1. class HSGLWidget : public QGLWidget
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. HSGLWidget(QWidget *parent = 0);
  7.  
  8. private:
  9. QRubberBand *rubberBand;
  10. QPoint origin;
  11.  
  12. protected:
  13.  
  14. void initializeGL();
  15. void resizeGL(int w, int h);
  16. //void paintGL();
  17.  
  18. void mousePressEvent(QMouseEvent *e);
  19. void mouseMoveEvent(QMouseEvent *e);
  20. void mouseReleaseEvent(QMouseEvent *e);
  21. void keyPressEvent(QKeyEvent *e);
  22. };
  23.  
  24.  
  25. void HSGLWidget::mousePressEvent( QMouseEvent *e )
  26. {
  27. origin = e->pos();
  28. if (!rubberBand)
  29. rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
  30. rubberBand->setGeometry(QRect(origin, QSize()));
  31. rubberBand->show();
  32.  
  33. }
  34.  
  35. void HSGLWidget::mouseMoveEvent( QMouseEvent *e )
  36. {
  37. rubberBand->setGeometry(QRect(origin, e->pos()).normalized());
  38.  
  39. }
  40.  
  41. void HSGLWidget::mouseReleaseEvent(QMouseEvent *e)
  42. {
  43. rubberBand->hide();
  44. }
To copy to clipboard, switch view to plain text mode 

It's working with this implementation but there is something weird when i press the mouse button and moving mouse i see many Qrubberband flooding on the HSGLWidget if i move mouse quickly there is few if move slowly there is huge flooding. What is the problem am i using something wrong or this is QRubberBand issue , thanks for you help.