mirror of https://github.com/CGAL/cgal
Update QGLWidget to QOpenGLWidget.
This commit is contained in:
parent
f335794799
commit
ae66bdce95
|
|
@ -6,8 +6,8 @@ int main(int argv, char **args)
|
|||
srand(1);
|
||||
QApplication app(argv, args);
|
||||
app.setApplicationName("Reconstruction_simplification_2 Demo");
|
||||
int i =0;
|
||||
MainWindow window;
|
||||
|
||||
window.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "glviewer.h"
|
||||
|
||||
GlViewer::GlViewer(QWidget *pParent)
|
||||
: QGLWidget(QGLFormat(QGL::SampleBuffers), pParent)
|
||||
: QOpenGLWidget(pParent)
|
||||
{
|
||||
m_scene = NULL;
|
||||
|
||||
|
|
@ -50,11 +50,11 @@ void GlViewer::initializeGL()
|
|||
glClearColor(1., 1., 1., 0.);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_SMOOTH);
|
||||
resizeGL(width(), height());
|
||||
}
|
||||
|
||||
void GlViewer::paintGL()
|
||||
{
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
if (!m_scene) return;
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ void GlViewer::wheelEvent(QWheelEvent *event)
|
|||
if (!m_scene) return;
|
||||
m_scale += 0.05 * (event->delta() / 120);
|
||||
if (m_scale <= 0.0) m_scale = 0.0;
|
||||
updateGL();
|
||||
update();
|
||||
}
|
||||
|
||||
void GlViewer::mousePressEvent(QMouseEvent *event)
|
||||
|
|
@ -120,7 +120,7 @@ void GlViewer::mouseMoveEvent(QMouseEvent *event)
|
|||
}
|
||||
|
||||
m_mouse_click = m_mouse_move;
|
||||
updateGL();
|
||||
update();
|
||||
}
|
||||
|
||||
void GlViewer::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
|
@ -140,7 +140,7 @@ void GlViewer::mouseReleaseEvent(QMouseEvent *event)
|
|||
|
||||
m_mouse_click = m_mouse_move;
|
||||
setCursor(QCursor(Qt::ArrowCursor));
|
||||
updateGL();
|
||||
update();
|
||||
}
|
||||
|
||||
void GlViewer::sample_mouse_path(const QPoint& point)
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#define GLWIDGET_H
|
||||
|
||||
// Qt
|
||||
#include <QGLWidget>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QPaintEvent>
|
||||
|
||||
// local
|
||||
#include "scene.h"
|
||||
|
||||
class GlViewer : public QGLWidget
|
||||
class GlViewer : public QOpenGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ maxNumRecentFiles(15), recentFileActs(15)
|
|||
connect(min_mass_slider, SIGNAL(valueChanged(int)), this, SLOT(update()));
|
||||
connect(this, SIGNAL(openRecentFile(QString)), this, SLOT(open(QString)));
|
||||
Q_EMIT update();
|
||||
viewer->update();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
@ -187,7 +188,7 @@ void MainWindow::on_actionSnapshot_triggered()
|
|||
QClipboard *qb = QApplication::clipboard();
|
||||
viewer->makeCurrent();
|
||||
viewer->raise();
|
||||
QImage snapshot = viewer->grabFrameBuffer(true);
|
||||
QImage snapshot = viewer->grabFramebuffer();
|
||||
qb->setImage(snapshot);
|
||||
QApplication::restoreOverrideCursor();
|
||||
std::cout << "done" << std::endl;
|
||||
|
|
|
|||
Loading…
Reference in New Issue