|
|
|
@ -2,31 +2,22 @@ import { |
|
|
|
|
Renderer, |
|
|
|
|
View, |
|
|
|
|
Text, |
|
|
|
|
Button, |
|
|
|
|
Window, |
|
|
|
|
Image, |
|
|
|
|
useEventHandler |
|
|
|
|
} from "@nodegui/react-nodegui"; |
|
|
|
|
import path from "path"; |
|
|
|
|
import React, { useState } from "react"; |
|
|
|
|
import { AspectRatioMode, QPushButtonEvents } from "@nodegui/nodegui"; |
|
|
|
|
import React from "react"; |
|
|
|
|
import { AspectRatioMode } from "@nodegui/nodegui"; |
|
|
|
|
|
|
|
|
|
import imageUrl from "../assets/sample.jpg"; |
|
|
|
|
import imageUrl from "../assets/nodegui.jpg"; |
|
|
|
|
const distImgUrl = path.resolve(__dirname, imageUrl); |
|
|
|
|
const minSize = {width: 500, height: 400}; |
|
|
|
|
|
|
|
|
|
const fixedSize = { width: 500, height: 500 }; |
|
|
|
|
const App = () => { |
|
|
|
|
const [time, setTime] = useState(new Date()); |
|
|
|
|
const btnHandler = useEventHandler( |
|
|
|
|
{ [QPushButtonEvents.clicked]: () => setTime(new Date()) }, |
|
|
|
|
[] |
|
|
|
|
); |
|
|
|
|
return ( |
|
|
|
|
<Window minSize={fixedSize} maxSize={fixedSize} styleSheet={styleSheet}> |
|
|
|
|
<Window minSize={minSize} styleSheet={styleSheet}> |
|
|
|
|
<View id="container"> |
|
|
|
|
<Button text="Update Time" on={btnHandler} /> |
|
|
|
|
<Text id="result">{`${time}`}</Text> |
|
|
|
|
<Text id="result">{`Time in epoc: ${time.getTime()}`}</Text> |
|
|
|
|
<Text style="font-size: 15px; font-weight: bold; margin-bottom: 20px;">Hello World</Text> |
|
|
|
|
<Image |
|
|
|
|
style={imageStyle} |
|
|
|
|
src={distImgUrl} |
|
|
|
@ -38,7 +29,9 @@ const App = () => { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const imageStyle = ` |
|
|
|
|
height: "70%"; |
|
|
|
|
height: "100px"; |
|
|
|
|
width: "100px"; |
|
|
|
|
qproperty-alignment: 'AlignHCenter'; |
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const styleSheet = ` |
|
|
|
@ -48,15 +41,6 @@ const styleSheet = ` |
|
|
|
|
min-height: '100%'; |
|
|
|
|
align-items: 'center'; |
|
|
|
|
justify-content: 'center'; |
|
|
|
|
background-color: black; |
|
|
|
|
} |
|
|
|
|
#opBtn { |
|
|
|
|
font-size: 20px; |
|
|
|
|
} |
|
|
|
|
#result { |
|
|
|
|
font-size: 12px; |
|
|
|
|
flex: 1; |
|
|
|
|
color: cyan; |
|
|
|
|
} |
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|