@ -3227,7 +3227,9 @@ void DefaultViewPort::setSize(QSize /*size_*/)
# ifdef HAVE_QT_OPENGL
# ifdef HAVE_QT_OPENGL
OpenGlViewPort : : OpenGlViewPort ( QWidget * _parent ) : QGLWidget ( _parent ) , OCVViewPort ( ) , size ( - 1 , - 1 )
// QOpenGLWidget vs QGLWidget info: https://www.qt.io/blog/2014/09/10/qt-weekly-19-qopenglwidget
OpenGlViewPort : : OpenGlViewPort ( QWidget * _parent ) : OpenCVQtWidgetBase ( _parent ) , OCVViewPort ( ) , size ( - 1 , - 1 )
{
{
glDrawCallback = 0 ;
glDrawCallback = 0 ;
glDrawData = 0 ;
glDrawData = 0 ;
@ -3281,7 +3283,11 @@ void OpenGlViewPort::makeCurrentOpenGlContext()
void OpenGlViewPort : : updateGl ( )
void OpenGlViewPort : : updateGl ( )
{
{
# ifdef HAVE_QT6
QOpenGLWidget : : update ( ) ;
# else
QGLWidget : : updateGL ( ) ;
QGLWidget : : updateGL ( ) ;
# endif
}
}
void OpenGlViewPort : : initializeGL ( )
void OpenGlViewPort : : initializeGL ( )
@ -3308,31 +3314,31 @@ void OpenGlViewPort::paintGL()
void OpenGlViewPort : : wheelEvent ( QWheelEvent * evnt )
void OpenGlViewPort : : wheelEvent ( QWheelEvent * evnt )
{
{
icvmouseEvent ( ( QMouseEvent * ) evnt , mouse_wheel ) ;
icvmouseEvent ( ( QMouseEvent * ) evnt , mouse_wheel ) ;
QGLWidget : : wheelEvent ( evnt ) ;
OpenCVQtWidgetBase : : wheelEvent ( evnt ) ;
}
}
void OpenGlViewPort : : mousePressEvent ( QMouseEvent * evnt )
void OpenGlViewPort : : mousePressEvent ( QMouseEvent * evnt )
{
{
icvmouseEvent ( evnt , mouse_down ) ;
icvmouseEvent ( evnt , mouse_down ) ;
QGLWidget : : mousePressEvent ( evnt ) ;
OpenCVQtWidgetBase : : mousePressEvent ( evnt ) ;
}
}
void OpenGlViewPort : : mouseReleaseEvent ( QMouseEvent * evnt )
void OpenGlViewPort : : mouseReleaseEvent ( QMouseEvent * evnt )
{
{
icvmouseEvent ( evnt , mouse_up ) ;
icvmouseEvent ( evnt , mouse_up ) ;
QGLWidget : : mouseReleaseEvent ( evnt ) ;
OpenCVQtWidgetBase : : mouseReleaseEvent ( evnt ) ;
}
}
void OpenGlViewPort : : mouseDoubleClickEvent ( QMouseEvent * evnt )
void OpenGlViewPort : : mouseDoubleClickEvent ( QMouseEvent * evnt )
{
{
icvmouseEvent ( evnt , mouse_dbclick ) ;
icvmouseEvent ( evnt , mouse_dbclick ) ;
QGLWidget : : mouseDoubleClickEvent ( evnt ) ;
OpenCVQtWidgetBase : : mouseDoubleClickEvent ( evnt ) ;
}
}
void OpenGlViewPort : : mouseMoveEvent ( QMouseEvent * evnt )
void OpenGlViewPort : : mouseMoveEvent ( QMouseEvent * evnt )
{
{
icvmouseEvent ( evnt , mouse_move ) ;
icvmouseEvent ( evnt , mouse_move ) ;
QGLWidget : : mouseMoveEvent ( evnt ) ;
OpenCVQtWidgetBase : : mouseMoveEvent ( evnt ) ;
}
}
@ -3340,8 +3346,7 @@ QSize OpenGlViewPort::sizeHint() const
{
{
if ( size . width ( ) > 0 & & size . height ( ) > 0 )
if ( size . width ( ) > 0 & & size . height ( ) > 0 )
return size ;
return size ;
return OpenCVQtWidgetBase : : sizeHint ( ) ;
return QGLWidget : : sizeHint ( ) ;
}
}
void OpenGlViewPort : : setSize ( QSize size_ )
void OpenGlViewPort : : setSize ( QSize size_ )
@ -3350,6 +3355,6 @@ void OpenGlViewPort::setSize(QSize size_)
updateGeometry ( ) ;
updateGeometry ( ) ;
}
}
# endif
# endif //HAVE_QT_OPENGL
# endif // HAVE_QT
# endif // HAVE_QT