Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
apedemak opened this issue Dec 28, 2021 · 1 comment
Open

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

apedemak opened this issue Dec 28, 2021 · 1 comment

Comments

@apedemak
Copy link

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.

@apedemak
Copy link
Author

apedemak commented Jan 5, 2023

Following up on this Issue.

Why can't the Webview be used as a "Child View" like any other widget?

Even the example/demo (Demo.ts) breaks and shows an error if you try and use the Webview as a child/widget.

It works only if you allow the widget to open in a new window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant