Commit e8b88b79 authored by Yannick TANGUY's avatar Yannick TANGUY

Merge branch '1626-qopenglwidget' into 'develop'

BUG: migrate to QOpenGLWidget

Closes #1796 and #1626

See merge request !655
parents 5772baac 08a1115a
Pipeline #3277 passed with stages
in 5 minutes and 37 seconds
......@@ -236,11 +236,11 @@ private:
private:
/**
*/
ImageViewWidget* CreateImageViewWidget(QGLWidget* sharedGlWidget = NULL);
ImageViewWidget* CreateImageViewWidget();
/**
*/
ImageViewWidget* CreateQuicklookViewWidget(QGLWidget* sharedGlWidget = NULL);
ImageViewWidget* CreateQuicklookViewWidget();
/**
*/
......
......@@ -258,8 +258,8 @@ void MainWindow::SetGLSLEnabled(bool enabled)
// Paint
// if( mustRefresh )
// {
// m_ImageView->updateGL();
// quicklookView->updateGL();
// m_ImageView->update();
// quicklookView->update();
// }
}
......@@ -405,7 +405,7 @@ void MainWindow::ConnectImageViews()
// SIGNAL( RefreshViewRequested() ),
// // to:
// m_ImageView,
// SLOT( updateGL() )
// SLOT( update() )
// );
//
......@@ -610,7 +610,7 @@ void MainWindow::InitializeDockWidgets()
// Quicklook-view dock-widget
assert(m_QuicklookViewDock == NULL);
assert(m_ImageView != NULL);
m_QuicklookViewDock = AddWidgetToDock(CreateQuicklookViewWidget(m_ImageView), "QUICKLOOK_VIEW", tr("Quicklook view"), Qt::RightDockWidgetArea);
m_QuicklookViewDock = AddWidgetToDock(CreateQuicklookViewWidget(), "QUICKLOOK_VIEW", tr("Quicklook view"), Qt::RightDockWidgetArea);
// Histogram-view.
assert(m_HistogramDock == NULL);
......@@ -722,7 +722,7 @@ void MainWindow::InitializeStatusBarWidgets()
}
/*****************************************************************************/
ImageViewWidget* MainWindow::CreateImageViewWidget(QGLWidget* sharedGlWidget)
ImageViewWidget* MainWindow::CreateImageViewWidget()
{
ImageViewRenderer* renderer = new ImageViewRenderer(this);
......@@ -734,7 +734,7 @@ ImageViewWidget* MainWindow::CreateImageViewWidget(QGLWidget* sharedGlWidget)
ImageViewWidget* imageView = new ImageViewWidget(manipulator, // (will be reparented.)
renderer, // (will be reparented.)
this, sharedGlWidget);
this);
imageView->setMinimumWidth(256);
......@@ -742,7 +742,7 @@ ImageViewWidget* MainWindow::CreateImageViewWidget(QGLWidget* sharedGlWidget)
}
/*****************************************************************************/
ImageViewWidget* MainWindow::CreateQuicklookViewWidget(QGLWidget* sharedGlWidget)
ImageViewWidget* MainWindow::CreateQuicklookViewWidget()
{
QuicklookViewRenderer* renderer = new QuicklookViewRenderer(this);
......@@ -754,7 +754,7 @@ ImageViewWidget* MainWindow::CreateQuicklookViewWidget(QGLWidget* sharedGlWidget
ImageViewWidget* quicklookView = new ImageViewWidget(manipulator, // (will be reparented.)
renderer, // (will be reparented.)
this, sharedGlWidget);
this);
quicklookView->SetPickingEnabled(false);
quicklookView->SetPickingDefaultStatus(false);
......@@ -979,12 +979,12 @@ void MainWindow::ImportImages(const QStringList& filenames, bool enableOverviews
}
assert(m_ImageView != NULL);
m_ImageView->updateGL();
m_ImageView->update();
ImageViewWidget* quicklookView = GetQuicklookView();
assert(quicklookView != NULL);
quicklookView->updateGL();
quicklookView->update();
}
/*****************************************************************************/
......@@ -1595,7 +1595,7 @@ void MainWindow::OnOTBApplicationOutputImageChanged(const QString&, const QStrin
// import the result image into the database
ImportImage(outfname, false);
m_ImageView->updateGL();
m_ImageView->update();
}
/*****************************************************************************/
......@@ -1694,14 +1694,14 @@ void MainWindow::OnSettingsUpdated()
assert(m_ImageView != NULL);
m_ImageView->updateGL();
m_ImageView->update();
//
ImageViewWidget* quicklookView = GetQuicklookView();
assert(quicklookView != NULL);
quicklookView->updateGL();
quicklookView->update();
}
/****************************************************************************/
......
......@@ -31,7 +31,7 @@
//
// Qt includes (sorted by alphabetic order)
#include <QGLWidget>
#include <QOpenGLWidget>
// #include <QtOpenGL>
//
......@@ -76,7 +76,7 @@ class AbstractImageViewManipulator;
* \ingroup OTBMonteverdiGUI
*
*/
class OTBMonteverdiGUI_EXPORT ImageViewWidget : public QGLWidget
class OTBMonteverdiGUI_EXPORT ImageViewWidget : public QOpenGLWidget
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
......@@ -92,17 +92,9 @@ public:
// Public methods.
public:
/** \brief Constructor. */
ImageViewWidget(AbstractImageViewManipulator* manipulator, AbstractImageViewRenderer* renderer, QWidget* p = NULL, const QGLWidget* shareWidget = NULL,
ImageViewWidget(AbstractImageViewManipulator* manipulator, AbstractImageViewRenderer* renderer, QWidget* p = NULL,
Qt::WindowFlags f = 0);
/** \brief Constructor. */
ImageViewWidget(AbstractImageViewManipulator* manipulator, AbstractImageViewRenderer* renderer, QGLContext* context, QWidget* p = NULL,
const QGLWidget* shareWidget = NULL, Qt::WindowFlags f = 0);
/** \brief Constructor. */
ImageViewWidget(AbstractImageViewManipulator* manipulator, AbstractImageViewRenderer* renderer, const QGLFormat& format, QWidget* p = NULL,
const QGLWidget* shareWidget = NULL, Qt::WindowFlags f = 0);
/** \brief Destructor. */
~ImageViewWidget() override;
......
......@@ -27,7 +27,7 @@
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
#include <QGLWidget>
#include <QOpenGLWidget>
// #include <QtOpenGL>
//
......
......@@ -71,9 +71,9 @@ namespace mvd
/*****************************************************************************/
/* CLASS IMPLEMENTATION SECTION */
/*******************************************************************************/
ImageViewWidget::ImageViewWidget(AbstractImageViewManipulator* manipulator, AbstractImageViewRenderer* renderer, QWidget* p, const QGLWidget* shareWidget,
ImageViewWidget::ImageViewWidget(AbstractImageViewManipulator* manipulator, AbstractImageViewRenderer* renderer, QWidget* p,
Qt::WindowFlags flags)
: QGLWidget(p, shareWidget, flags),
: QOpenGLWidget(p, flags),
m_IsPickingEnabled(true),
m_PickingDefaultStatus(true),
m_Manipulator(NULL),
......@@ -86,34 +86,6 @@ ImageViewWidget::ImageViewWidget(AbstractImageViewManipulator* manipulator, Abst
Initialize(manipulator, renderer);
}
/*******************************************************************************/
ImageViewWidget::ImageViewWidget(AbstractImageViewManipulator* manipulator, AbstractImageViewRenderer* renderer, QGLContext* glcontext, QWidget* p,
const QGLWidget* shareWidget, Qt::WindowFlags flags)
: QGLWidget(glcontext, p, shareWidget, flags),
m_Manipulator(NULL),
m_Renderer(NULL)
#if USE_XP_REGION_OPTION
,
m_Position()
#endif // USE_XP_REGION_OPTION
{
Initialize(manipulator, renderer);
}
/*******************************************************************************/
ImageViewWidget::ImageViewWidget(AbstractImageViewManipulator* manipulator, AbstractImageViewRenderer* renderer, const QGLFormat& glformat, QWidget* p,
const QGLWidget* shareWidget, Qt::WindowFlags flags)
: QGLWidget(glformat, p, shareWidget, flags),
m_Manipulator(NULL),
m_Renderer(NULL)
#if USE_XP_REGION_OPTION
,
m_Position()
#endif // USE_XP_REGION_OPTION
{
Initialize(manipulator, renderer);
}
/*******************************************************************************/
ImageViewWidget::~ImageViewWidget()
{
......@@ -164,7 +136,7 @@ void ImageViewWidget::SetLayerStack(StackedLayerModel* stackedLayerModel)
QObject::disconnect(model, SIGNAL(OrderChanged()),
// from:
this, SLOT(updateGL()));
this, SLOT(update()));
//
// Disconnect layer-stack model from this widget manipulator.
......@@ -223,7 +195,7 @@ void ImageViewWidget::SetLayerStack(StackedLayerModel* stackedLayerModel)
QObject::connect(stackedLayerModel, SIGNAL(OrderChanged()),
// to:
this, SLOT(updateGL()));
this, SLOT(update()));
QObject::connect(stackedLayerModel, SIGNAL(ContentChanged()),
// to:
......@@ -425,7 +397,7 @@ void ImageViewWidget::initializeGL()
/*******************************************************************************/
void ImageViewWidget::resizeGL(int w, int h)
{
QGLWidget::resizeGL(w, h);
QOpenGLWidget::resizeGL(w, h);
assert(m_Renderer != NULL);
......@@ -435,7 +407,7 @@ void ImageViewWidget::resizeGL(int w, int h)
/*******************************************************************************/
void ImageViewWidget::paintGL()
{
QGLWidget::paintGL();
QOpenGLWidget::paintGL();
// qDebug() << this << "::paintGL()";
......@@ -485,7 +457,7 @@ void ImageViewWidget::mousePressEvent(QMouseEvent* e)
{
assert(e != NULL);
QGLWidget::mousePressEvent(e);
QOpenGLWidget::mousePressEvent(e);
m_Manipulator->MousePressEvent(e);
......@@ -501,7 +473,7 @@ void ImageViewWidget::mouseMoveEvent(QMouseEvent* e)
// qDebug() << this << "::mouseMove(" << event << ")";
// Superclass default behaviour.
QGLWidget::mouseMoveEvent(e);
QOpenGLWidget::mouseMoveEvent(e);
//
// Get layer-stack.
......@@ -551,7 +523,7 @@ void ImageViewWidget::mouseMoveEvent(QMouseEvent* e)
#endif // USE_XP_REGION_OPTIM
// qDebug() << "updateGL(" << in[ 0 ] << "," << in[ 1 ] << ")";
// qDebug() << "update(" << in[ 0 ] << "," << in[ 1 ] << ")";
isAnyEffectActive = true;
......@@ -639,7 +611,7 @@ void ImageViewWidget::mouseMoveEvent(QMouseEvent* e)
}
if (isAnyEffectActive)
updateGL();
update();
}
/*******************************************************************************/
......@@ -647,7 +619,7 @@ void ImageViewWidget::mouseReleaseEvent(QMouseEvent* e)
{
assert(e != NULL);
QGLWidget::mouseReleaseEvent(e);
QOpenGLWidget::mouseReleaseEvent(e);
m_Manipulator->MouseReleaseEvent(e);
......@@ -660,7 +632,7 @@ void ImageViewWidget::mouseDoubleClickEvent(QMouseEvent* e)
{
assert(e != NULL);
QGLWidget::mouseDoubleClickEvent(e);
QOpenGLWidget::mouseDoubleClickEvent(e);
m_Manipulator->MouseDoubleClickEvent(e);
}
......@@ -670,7 +642,7 @@ void ImageViewWidget::wheelEvent(QWheelEvent* e)
{
assert(e != NULL);
QGLWidget::wheelEvent(e);
QOpenGLWidget::wheelEvent(e);
m_Manipulator->WheelEvent(e);
}
......@@ -683,7 +655,7 @@ void ImageViewWidget::resizeEvent(QResizeEvent* e)
// qDebug() << this << "::resizeEvent(" << e << ")";
// First, call superclass implementation
QGLWidget::resizeEvent(e);
QOpenGLWidget::resizeEvent(e);
m_Manipulator->ResizeEvent(e);
}
......@@ -693,7 +665,7 @@ void ImageViewWidget::keyPressEvent(QKeyEvent* e)
{
assert(e != NULL);
QGLWidget::keyPressEvent(e);
QOpenGLWidget::keyPressEvent(e);
m_Manipulator->KeyPressEvent(e);
}
......@@ -703,7 +675,7 @@ void ImageViewWidget::keyReleaseEvent(QKeyEvent* e)
{
assert(e != NULL);
QGLWidget::keyReleaseEvent(e);
QOpenGLWidget::keyReleaseEvent(e);
m_Manipulator->KeyReleaseEvent(e);
}
......@@ -868,7 +840,7 @@ void ImageViewWidget::Connect(AbstractLayerModel* layer)
QObject::connect(layer, SIGNAL(VisibilityChanged()),
// to:
this, SLOT(updateGL()));
this, SLOT(update()));
QObject::connect(this, SIGNAL(ModelUpdated()),
// to:
......@@ -882,7 +854,7 @@ void ImageViewWidget::Disconnect(AbstractLayerModel* layer)
QObject::disconnect(layer, SIGNAL(VisibilityChanged()),
// from:
this, SLOT(updateGL()));
this, SLOT(update()));
QObject::disconnect(this, SIGNAL(ModelUpdated()),
// from:
......@@ -1110,7 +1082,7 @@ void ImageViewWidget::OnClearProjectionRequired()
ZoomToExtent();
// Done in ::ZoomToExtent().
// updateGL();
// update();
}
/******************************************************************************/
......@@ -1123,7 +1095,7 @@ void ImageViewWidget::OnContentChanged()
UpdateScene();
if (!ApplyFixedZoomType())
updateGL();
update();
}
/******************************************************************************/
......@@ -1136,7 +1108,7 @@ void ImageViewWidget::OnContentReset()
UpdateScene();
if (!ApplyFixedZoomType())
updateGL();
update();
}
/******************************************************************************/
......@@ -1216,7 +1188,7 @@ void ImageViewWidget::OnReferenceChanged(size_t)
m_Renderer->RefreshScene();
updateGL();
update();
}
/******************************************************************************/
......@@ -1224,7 +1196,7 @@ void ImageViewWidget::OnRefreshViewRequested()
{
// qDebug() << this << "::OnRefreshViewRequested()";
updateGL();
update();
}
/******************************************************************************/
......@@ -1409,10 +1381,10 @@ void ImageViewWidget::OnRoiChanged(const PointType&, const SizeType&, const Spac
// qDebug() << "sx:" << sx << "; sy:" << sy;
// qDebug() << "rsx:" << rsx << "; rsy:" << rsy;
// qDebug() << this << "::updateGL()";
// qDebug() << this << "::update()";
// Refresh view.
updateGL();
update();
// Emit absolute scale.
emit ScaleChanged(rsx, rsy);
......@@ -1525,7 +1497,7 @@ void ImageViewWidget::OnSelectFirstLayerRequested()
stackedLayerModel->SelectFirst();
updateGL();
update();
}
/******************************************************************************/
......@@ -1540,7 +1512,7 @@ void ImageViewWidget::OnSelectLastLayerRequested()
stackedLayerModel->SelectLast();
updateGL();
update();
}
/******************************************************************************/
......@@ -1555,7 +1527,7 @@ void ImageViewWidget::OnSelectPreviousLayerRequested()
stackedLayerModel->SelectPrevious();
updateGL();
update();
}
/******************************************************************************/
......@@ -1570,7 +1542,7 @@ void ImageViewWidget::OnSelectNextLayerRequested()
stackedLayerModel->SelectNext();
updateGL();
update();
}
/******************************************************************************/
......@@ -2001,7 +1973,7 @@ ImageViewWidget
UpdateScene();
updateGL();
update();
return glslEnabled;
}
......@@ -2038,7 +2010,7 @@ void ImageViewWidget::ZoomToExtent()
Center(ZOOM_TYPE_EXTENT);
// Refresh view.
updateGL();
update();
}
/******************************************************************************/
......@@ -2050,7 +2022,7 @@ void ImageViewWidget::ZoomToLayerExtent()
Center(ZOOM_TYPE_LAYER);
// Refresh view.
updateGL();
update();
}
/******************************************************************************/
......@@ -2065,7 +2037,7 @@ void ImageViewWidget::ZoomToFullResolution()
Center(ZOOM_TYPE_FULL);
// Refresh view.
updateGL();
update();
}
/******************************************************************************/
......@@ -2076,7 +2048,7 @@ void ImageViewWidget::ZoomIn()
m_Manipulator->ZoomIn();
// Refresh view.
updateGL();
update();
}
/******************************************************************************/
......@@ -2087,6 +2059,6 @@ void ImageViewWidget::ZoomOut()
m_Manipulator->ZoomOut();
// Refresh view.
updateGL();
update();
}
}
......@@ -27,7 +27,7 @@
//
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
#include <QGLWidget>
#include <QOpenGLWidget>
// #include <QtOpenGL>
//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment