Full screen when working with opengl in wasm
-
There are two layouts in the cavas in my test, one owns some widgets as tools on the left, and another owns a drawing area wokring with OpenGL. It works in desktop app. But after I complied it to wasm, there is only drawing area in the explore, but the other parts are in black background.
mainwindow.cpp:
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->plottingLayout->addWidget(new Window(this));
ui->frame->setStyleSheet("background-color:cyan;");
}window.cpp for adding OpenGlWidget:
Window::Window(MainWindow *mw)
: mainWindow(mw)
{
glWidget = new GLWidget;xSlider = createSlider();
ySlider = createSlider();
zSlider = createSlider();connect(xSlider, &QSlider::valueChanged, glWidget, &GLWidget::setXRotation);
connect(glWidget, &GLWidget::xRotationChanged, xSlider, &QSlider::setValue);
connect(ySlider, &QSlider::valueChanged, glWidget, &GLWidget::setYRotation);
connect(glWidget, &GLWidget::yRotationChanged, ySlider, &QSlider::setValue);
connect(zSlider, &QSlider::valueChanged, glWidget, &GLWidget::setZRotation);
connect(glWidget, &GLWidget::zRotationChanged, zSlider, &QSlider::setValue);QVBoxLayout *mainLayout = new QVBoxLayout;
QHBoxLayout *container = new QHBoxLayout;
container->addWidget(glWidget);
container->addWidget(xSlider);
container->addWidget(ySlider);
container->addWidget(zSlider);QWidget *w = new QWidget;
w->setLayout(container);
mainLayout->addWidget(w);
dockBtn = new QPushButton(tr("Undock"), this);
connect(dockBtn, &QPushButton::clicked, this, &Window::dockUndock);
mainLayout->addWidget(dockBtn);setLayout(mainLayout);
xSlider->setValue(15 * 16);
ySlider->setValue(345 * 16);
zSlider->setValue(0 * 16);setWindowTitle(tr("Hello GL"));
}
GLwidge:
class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
Q_OBJECTpublic:
GLWidget(QWidget *parent = nullptr);
~GLWidget();static bool isTransparent() { return m_transparent; }
static void setTransparent(bool t) { m_transparent = t; }QSize minimumSizeHint() const override;
QSize sizeHint() const override;...
}In fact, the test is from "Hello GL2 Example", I just add an UI named mainwindow.ui,and attache several buttons on the left layout, and add the OpenGLWidget to the right layout as drawing area.
Does it work well for Qt wasm in such case? Full screen in OpenGL Mode?