fix: splitter ratio
This commit is contained in:
@@ -5,6 +5,7 @@ class MyGLWidget : public QOpenGLWidget
|
||||
{
|
||||
public:
|
||||
MyGLWidget(QWidget *parent) : QOpenGLWidget(parent) { }
|
||||
QSize sizeHint() const override { return QSize(-1, -1); }
|
||||
|
||||
protected:
|
||||
void initializeGL() override
|
||||
@@ -14,6 +15,8 @@ protected:
|
||||
f->glClearColor(0.16f, 0.16f, 0.16f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void resizeGL(int w, int h) override
|
||||
{
|
||||
// // Update projection matrix and other size related settings:
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "gui/viewport/Viewport.h"
|
||||
#include <qboxlayout.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <iostream>
|
||||
#include <QTimer>
|
||||
|
||||
Viewport::Viewport(QWidget *parent, Qt::WindowFlags f)
|
||||
: QWidget(parent, f)
|
||||
@@ -8,7 +10,15 @@ Viewport::Viewport(QWidget *parent, Qt::WindowFlags f)
|
||||
mainLayout_=new QVBoxLayout();
|
||||
openGLWidget_ = new MyGLWidget(this);
|
||||
mainLayout_->addWidget(openGLWidget_);
|
||||
openGLWidget_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
// mainLayout_->addWidget(new QPushButton("hello world"));
|
||||
this->setLayout(mainLayout_);
|
||||
// this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
// QTimer::singleShot(100, this, [=] {
|
||||
// std::cout << "MyGLWidget size: " << openGLWidget_->width() << " x " << openGLWidget_->height() << std::endl;
|
||||
// });
|
||||
|
||||
|
||||
setLayout(mainLayout_);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user