Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 557a8f6

Browse files
committed
Port all guides to Svelte NodeGUI
1 parent 2a594cc commit 557a8f6

File tree

9 files changed

+390
-402
lines changed

9 files changed

+390
-402
lines changed

website/docs/guides/debugging-in-vscode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ title: Debugging in VSCode
3636

3737
- **Debugging**
3838

39-
Set some breakpoints in `index.js`, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging). You should be able to hit the breakpoints.
39+
Set some breakpoints in `index.js`, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging). You should be able to hit the breakpoints.

website/docs/guides/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ Congratulations! You've successfully run and modified your first Svelte NodeGui
136136

137137
### Now what?
138138

139-
If you're curious to learn more about NodeGui, continue on to the [tutorial](tutorial.md).
139+
If you're curious to learn more about Svelte NodeGui, continue on to the [tutorial](tutorial.md).
140140

141-
[quick-start]: https://github.com/nodegui/nodegui-starter
141+
[quick-start]: https://github.com/nodegui/svelte-nodegui-starter

website/docs/guides/handle-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ sidebar_label: Handle Events
33
title: Handle Events
44
---
55

6-
Svelte NodeGui allows you to listen to various events that might originate from the underlying Qt widgets. These events can either be a simple button click or a text change on a lineedit or even something like window being hidden and shown.
6+
Svelte NodeGui allows you to listen to various events that might originate from the underlying Qt widgets. These events can either be a simple button click or a text change on a LineEdit or even something like window being hidden and shown.
77

88
In order to do this we need to attach an event listener to the respective widget.
99

website/docs/guides/images.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,32 @@ title: Images
55

66
Images are very important for making your app more interesting.
77

8-
In React NodeGui, `<Image>` is used to display an image.
8+
In Svelte NodeGui, `<image>` is used to display an image.
99

1010
Internally Image is a QLabel. QLabel is typically used for displaying text, but it can also display an image.
11-
What this means is that you can pass all the props you pass to a `<Text>` to `<Image>` also.
11+
What this means is that you can pass all the props you pass to a `<text>` to `<image>` also.
1212

1313
A very minimal example would look like this:
1414

15-
```js
16-
import React from "react";
17-
import { Renderer, Image, Window } from "@nodegui/react-nodegui";
18-
19-
const App = () => {
20-
return (
21-
<Window>
22-
<Image src="https://docs.nodegui.org/img/logo-circle.png" />
23-
</Window>
24-
);
25-
};
26-
27-
Renderer.render(<App />);
15+
```svelte
16+
<script lang="ts">
17+
import { onMount } from "svelte";
18+
import { QLabelSignals, QMouseEvent, WidgetEventTypes } from "@nodegui/nodegui";
19+
let win;
20+
21+
onMount(() => {
22+
(window as any).win = win; // Prevent garbage collection.
23+
win.nativeView.show();
24+
return () => {
25+
delete (window as any).win;
26+
};
27+
});
28+
</script>
29+
30+
<svelte:options namespace="foreign" />
31+
<window bind:this={win}>
32+
<image src="https://docs.nodegui.org/img/logo-circle.png" />
33+
</window>
2834
```
2935

3036
Here,
@@ -43,12 +49,12 @@ The above examples wont allow you to show a huge image without either cutting it
4349

4450
In order to do that:
4551

46-
- You can create the image instance using `<Image>`
47-
- Set the image instance as a child to a `<ScrollArea>`
52+
- You can create the image instance using `<image>`
53+
- Set the image instance as a child to a `<scrollArea>`
4854

4955
### Animated images
5056

51-
In order to use animated images, instead of `<Image>` use `<AnimatedImage>`
57+
In order to use animated images, instead of `<image>` use `<animatedImage>`
5258

5359
### Loading an image from a buffer
5460

0 commit comments

Comments
 (0)