#ifndef HSGLWIDGET_H
#define HSGLWIDGET_H
#include <QtOpenGL/QGLWidget>
#include <QMouseEvent>
#include <QRubberBand>
#include <QPoint>
{
public:
}
{
Q_UNUSED(event);
pen.setWidth(5);
pen.setStyle(Qt::DashLine);
painter.begin(this);
painter.setPen(pen);
painter.setOpacity(0.5);
painter.setBrush(brush);
painter.drawRect(event->rect());
painter.end();
}
};
{
Q_OBJECT
public:
private:
CustomRB *rubberBand;
protected:
void initializeGL();
void resizeGL(int w, int h);
//void paintGL();
};
#endif // HSGLWIDGET_H
#include "hsglwidget.h"
HSGLWidget
::HSGLWidget(QWidget *parent
){
rubberBand
= new CustomRB
(QRubberBand::Rectangle,
this);
}
void HSGLWidget::initializeGL()
{
}
void HSGLWidget::resizeGL( int w, int h )
{
}
{
origin = e->pos();
rubberBand->setUpdatesEnabled(true);
rubberBand->show();
}
{
rubberBand
->setGeometry
(QRect(origin, e
->pos
()).
normalized());
}
void HSGLWidget
::keyPressEvent( QKeyEvent *e
) {
}
{
rubberBand
->setGeometry
(QRect(origin, e
->pos
()).
normalized());
rubberBand->show();
}