From 9cf8ab8bebea16a8d1bd36e933406f8b4ce8522b Mon Sep 17 00:00:00 2001 From: Graham Stewart <25826331+gramnation@users.noreply.github.com> Date: Sun, 23 Aug 2020 07:50:01 -0500 Subject: [PATCH] Update osgQOpenGLWidget "When implementing a new widget, it is almost always useful to reimplement sizeHint() to provide a reasonable default size for the widget and to set the correct size policy with setSizePolicy()." https://doc.qt.io/qt-5/qwidget.html#size-hints-and-size-policies Default value of QWidget::rect is 0,0,640,480. This SD aspect ratio agrees with OSG when widget is shown by itself. However, once widget is put into a layout it has to return a valid sizeHint in order to preserve this aspect ratio and size. --- include/osgQOpenGL/osgQOpenGLWidget | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/osgQOpenGL/osgQOpenGLWidget b/include/osgQOpenGL/osgQOpenGLWidget index a5a7ae5..72aa53e 100644 --- a/include/osgQOpenGL/osgQOpenGLWidget +++ b/include/osgQOpenGL/osgQOpenGLWidget @@ -53,7 +53,10 @@ public: //! get mutex virtual OpenThreads::ReadWriteMutex* mutex(); - + + //! override this to change default size or aspect ratio + QSize sizeHint() const override { return QSize(640,480); } + signals: void initialized();