Skip to content

Can't add Webview as Widget to Another Layout #22

@apedemak

Description

@apedemak

For whatever reason the Webview only seems to work in its own window.
Once I try to add the Webview as a widget to the layout of another element, the app no longer launches.

WORKING EXAMPLE (EXAMPLE #1):

import { QWebEngineView, QWebChannel } from "nodegui-plugin-webview";
const webview = new QWebEngineView();
webview.setInlineStyle("align-self:'stretch';");
webview.load("http://google.com");

const channel = new QWebChannel();
webview.page().setWebChannel(channel);

webview.show();
(global as any).wv = webview;

NOT WORKING EXAMPLE (EXAMPLE #2):

import { QWebEngineView, QWebChannel } from "nodegui-plugin-webview";
import {
  QMainWindow,
  QWidget,
  FlexLayout,
  QPushButton
} from "@nodegui/nodegui";

const win = new QMainWindow();
const center = new QWidget();
const webview = new QWebEngineView();
webview.setInlineStyle("align-self:'stretch';");
webview.load("http://google.com");

const channel = new QWebChannel();
webview.page().setWebChannel(channel);

const button = new QPushButton();
button.setText("Hello");

center.setLayout(new FlexLayout());
center.layout?.addWidget(webview);
center.layout?.addWidget(button);
win.setCentralWidget(center);
win.show();
(global as any).win = win;

Example #1 works and the app launches, example #2 produces this error:

  • webpack 5.49.0 compiled successfully in 3012 ms
  • QtWebEngineProcess[14121] : read failed
  • QtWebEngineProcess[14121] : SeatbeltExecServer: failed to read buffer length.

The app starts to launch, then closes immediately.

No sure what is going on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions