Skip to content

Commit a42dd94

Browse files
committed
All existing widgets have reached methods parity with that of their NodeGUI counterparts
1 parent 5f5a29e commit a42dd94

File tree

5 files changed

+31
-13
lines changed

5 files changed

+31
-13
lines changed

src/components/Button/index.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { ViewProps, setProps as setViewProps } from "../View";
44

55
interface ButtonProps extends ViewProps {
66
text?: string;
7-
isFlat?: boolean;
8-
icon?: string;
7+
flat?: boolean;
8+
icon?: QIcon;
99
}
1010

1111
const setProps = (
@@ -17,11 +17,10 @@ const setProps = (
1717
set text(buttonText: string) {
1818
widget.setText(buttonText);
1919
},
20-
set isFlat(isFlat: boolean) {
20+
set flat(isFlat: boolean) {
2121
widget.setFlat(isFlat);
2222
},
23-
set icon(iconUrl: string) {
24-
const icon = new QIcon(iconUrl);
23+
set icon(icon: QIcon) {
2524
widget.setIcon(icon);
2625
}
2726
};

src/components/Image/ImageLabel.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ export class ImageLabel extends QLabel {
44
originalPixmap?: QPixmap;
55
aspectRatioMode?: AspectRatioMode;
66
setPixmap = (pixmap: QPixmap) => {
7+
// react:✓
78
super.setPixmap(pixmap);
89
this.originalPixmap = pixmap;
910
};
1011
setAspectRatioMode = (mode: AspectRatioMode) => {
12+
// react:✓ TODO://getter
1113
this.aspectRatioMode = mode;
1214
};
1315
scalePixmap = (width: number, height: number) => {

src/components/PlainTextEdit/index.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
21
import { registerComponent } from "../config";
3-
import { QPlainTextEdit, QPlainTextEditEvents } from "@nodegui/nodegui";
2+
import { QPlainTextEdit } from "@nodegui/nodegui";
43
import { ViewProps, setProps as setViewProps } from "../View";
54

65
interface PlainTextEditProps extends ViewProps {
76
children?: string;
87
text?: string;
8+
readOnly?: boolean;
99
}
1010

1111
const setProps = (
@@ -17,6 +17,9 @@ const setProps = (
1717
set text(text: string) {
1818
text ? widget.setPlainText(text) : widget.clear();
1919
},
20+
set readOnly(isReadOnly: boolean) {
21+
widget.setReadOnly(isReadOnly);
22+
}
2023
};
2124
Object.assign(setter, newProps);
2225
setViewProps(widget, newProps, oldProps);

src/components/ProgressBar/index.ts

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
import { registerComponent } from "../config";
2-
import { QProgressBar } from "@nodegui/nodegui";
2+
import { QProgressBar, Orientation } from "@nodegui/nodegui";
33
import { ViewProps, setProps as setViewProps } from "../View";
44

5-
interface ProgressBarProps extends ViewProps {}
5+
interface ProgressBarProps extends ViewProps {
6+
value?: number;
7+
minimum?: number;
8+
maximum?: number;
9+
orientation?: Orientation;
10+
}
611

712
const setProps = (
813
widget: QProgressBar,
914
newProps: ProgressBarProps,
1015
oldProps: ProgressBarProps
1116
) => {
1217
const setter: ProgressBarProps = {
13-
// set text(checkboxText: string) {
14-
// widget.setText(checkboxText);
15-
// }
18+
set value(val: number) {
19+
widget.setValue(val);
20+
},
21+
set minimum(min: number) {
22+
widget.setMinimum(min);
23+
},
24+
set maximum(max: number) {
25+
widget.setMaximum(max);
26+
},
27+
set orientation(orientation: Orientation) {
28+
widget.setOrientation(orientation);
29+
}
1630
};
1731
Object.assign(setter, newProps);
1832
setViewProps(widget, newProps, oldProps);

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ export { Renderer } from "./renderer";
22
export { View } from "./components/View";
33
export { Window } from "./components/Window";
44
export { Text } from "./components/Text";
5+
export { Image } from "./components/Image";
56
export { Button } from "./components/Button";
67
export { CheckBox } from "./components/CheckBox";
78
export { LineEdit } from "./components/LineEdit";
89
export { PlainTextEdit } from "./components/PlainTextEdit";
910
export { ProgressBar } from "./components/ProgressBar";
1011
export { RadioButton } from "./components/RadioButton";
11-
export { Image } from "./components/Image";
1212
export { useEventHandler } from "./hooks";

0 commit comments

Comments
 (0)