Skip to content

Commit a7f7af4

Browse files
committed
update demo
1 parent e685383 commit a7f7af4

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ add_library(${PLUGIN_ADDON_NAME} SHARED
2323
"${PROJECT_SOURCE_DIR}/src/cpp/QWebEngineSettings/qwebenginesettings_wrap.cpp"
2424
)
2525

26-
AddPluginConfig(${PLUGIN_ADDON_NAME})
2726
AddQtWebSupport(${PLUGIN_ADDON_NAME})
27+
AddPluginConfig(${PLUGIN_ADDON_NAME})
2828

2929
target_include_directories(${PLUGIN_ADDON_NAME} PRIVATE
3030
"${CMAKE_JS_INC}"
@@ -34,5 +34,8 @@ target_link_libraries(${PLUGIN_ADDON_NAME} PRIVATE
3434
"${CMAKE_JS_LIB}"
3535
Qt5::WebEngineCore
3636
Qt5::WebEngineWidgets
37+
Qt5::Core
38+
Qt5::Widgets
39+
Qt5::Gui
3740
)
3841

src/demo.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { QWebEngineView } from "./index";
2-
import {
3-
QMainWindow,
4-
QWidget,
5-
FlexLayout,
6-
QPushButton
7-
} from "@nodegui/nodegui";
2+
// import {
3+
// QMainWindow,
4+
// QWidget,
5+
// FlexLayout,
6+
// QPushButton
7+
// } from "@nodegui/nodegui";
88

9-
const win = new QMainWindow();
10-
const center = new QWidget();
9+
// const win = new QMainWindow();
10+
// const center = new QWidget();
1111
const webview = new QWebEngineView();
1212
webview.setInlineStyle("align-self:'stretch';");
1313
webview.load("http://google.com");
@@ -18,12 +18,15 @@ webview.addEventListener("selectionChanged", () => {
1818
console.log("selection", webview.property("selectedText").toString());
1919
});
2020

21-
const button = new QPushButton();
22-
button.setText("Hello");
21+
webview.show();
22+
(global as any).wv = webview;
2323

24-
center.setLayout(new FlexLayout());
25-
center.layout?.addWidget(webview);
26-
center.layout?.addWidget(button);
27-
win.setCentralWidget(center);
28-
win.show();
29-
(global as any).win = win;
24+
// const button = new QPushButton();
25+
// button.setText("Hello");
26+
27+
// center.setLayout(new FlexLayout());
28+
// center.layout?.addWidget(webview);
29+
// center.layout?.addWidget(button);
30+
// win.setCentralWidget(center);
31+
// win.show();
32+
// (global as any).win = win;

0 commit comments

Comments
 (0)