Skip to content

Commit 5f5a29e

Browse files
committed
Adds QLabel props also to Image since image is actually QLabel underneath
1 parent fa31242 commit 5f5a29e

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/components/Image/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { registerComponent } from "../config";
22
import { QPixmap, QLabelEvents, AspectRatioMode } from "@nodegui/nodegui";
3-
import { ViewProps, setProps as setViewProps } from "../View";
43
import { ImageLabel } from "./ImageLabel";
5-
interface ImageProps extends ViewProps {
4+
import { TextProps, setProps as setTextProps } from "../Text";
5+
interface ImageProps extends TextProps {
66
src?: string;
77
aspectRatioMode?: AspectRatioMode;
88
}
@@ -27,7 +27,7 @@ const setProps = (
2727
}
2828
};
2929
Object.assign(setter, newProps);
30-
setViewProps(widget, newProps, oldProps);
30+
setTextProps(widget, newProps, oldProps);
3131
};
3232

3333
export const Image = registerComponent<ImageProps>({

src/components/Text/index.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ import { registerComponent } from "../config";
22
import { QLabel } from "@nodegui/nodegui";
33
import { ViewProps, setProps as setViewProps } from "../View";
44

5-
interface TextProps extends ViewProps {
5+
export interface TextProps extends ViewProps {
66
children?: string | number;
77
wordWrap?: boolean;
88
}
99

10-
const setProps = (widget: QLabel, newProps: TextProps, oldProps: TextProps) => {
10+
export const setProps = (
11+
widget: QLabel,
12+
newProps: TextProps,
13+
oldProps: TextProps
14+
) => {
1115
const setter: TextProps = {
1216
set children(text: string | number) {
1317
widget.setText(text);

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export { Renderer } from "./renderer";
22
export { View } from "./components/View";
3+
export { Window } from "./components/Window";
34
export { Text } from "./components/Text";
45
export { Button } from "./components/Button";
56
export { CheckBox } from "./components/CheckBox";
@@ -8,5 +9,4 @@ export { PlainTextEdit } from "./components/PlainTextEdit";
89
export { ProgressBar } from "./components/ProgressBar";
910
export { RadioButton } from "./components/RadioButton";
1011
export { Image } from "./components/Image";
11-
export { Window } from "./components/Window";
1212
export { useEventHandler } from "./hooks";

0 commit comments

Comments
 (0)