nodegui / qode

DEPRECATED: Please see https://github.com/nodegui/qodejs instead
https://nodegui.github.io/nodegui/#/tutorial/application-architecture?id=qode
91 stars 10 forks source link

Question: What's wrong with my env? #17

Open lightness opened 4 years ago

lightness commented 4 years ago

Hi. First of all thanks for such interesting idea! 🚀

I just stuck with small issue when trying out starter project (https://docs.nodegui.org/docs/guides/tutorial/#trying-out-the-starter-project)

When I running npm start webpack works well, but then I don't see any window. I see qode application in the Dock, but not window.

Probably I miss something. Could you help me with that, please? Thanks!

Env: OS: MacOS Catalina v10.15.3

$ node -v
v10.17.0
$ npm -v
6.13.0
$ npm list @nodegui/qode
nodegui-starter@1.0.0 /Users/nb-078-11b/projects/nodegui-starter
└─┬ @nodegui/nodegui@0.16.1
  └── @nodegui/qode@2.0.4 
a7ul commented 4 years ago

Could you post the contents of index.ts file ? @lightness

lightness commented 4 years ago

Sure @master-atul

import { QMainWindow, QWidget, QLabel, FlexLayout, QPushButton, QIcon } from '@nodegui/nodegui';
import logo from '../assets/logox200.png';

const win = new QMainWindow();
win.setWindowTitle("Hello World");

const centralWidget = new QWidget();
centralWidget.setObjectName("myroot");
const rootLayout = new FlexLayout();
centralWidget.setLayout(rootLayout);

const label = new QLabel();
label.setObjectName("mylabel");
label.setText("Hello");

const button = new QPushButton();
button.setIcon(new QIcon(logo));

const label2 = new QLabel();
label2.setText("World");
label2.setInlineStyle(`
  color: red;
`);

rootLayout.addWidget(label);
rootLayout.addWidget(button);
rootLayout.addWidget(label2);
win.setCentralWidget(centralWidget);
win.setStyleSheet(
  `
    #myroot {
      background-color: #009688;
      height: '100%';
      align-items: 'center';
      justify-content: 'center';
    }
    #mylabel {
      font-size: 16px;
      font-weight: bold;
      padding: 1;
    }
  `
);
win.show();

(global as any).win = win;