nodeguy/website/docs/api/QMainWindow.md
Atul R eca218ac79
Adds new doc site (#124)
* Adds base template for new docs site

* Adds Apis to docs

* add some css from rn

* Fix right side sidebar functionality

* Basic docs

* adds old docs

* Cleans up unnecessary files

* Chane links

* Adds docusaurus v2

* Styling fixes

* adds wip and new assets

* adds code image

* Add FAQ link

* Adds analytics

* adds cname

* cleanup blogs
2019-09-29 20:14:35 +02:00

1.8 KiB

sidebar_label title
QMainWindow QMainWindow

Create and control windows.

This class is a JS wrapper around Qt's QMainWindow class

A QMainWindow provides a main application window. Every widget in NodeGui should be a child/nested child of QMainWindow. QMainWindow in NodeGui is also responsible for FlexLayout calculations of its children.

QMainWindow inherits from NodeWidget

Example

const { QMainWindow, QWidget } = require("@nodegui/nodegui");

const win = new QMainWindow();

const centralWidget = new QWidget();
win.setCentralWidget(centralWidget);

win.show();

global.win = win; // prevent's gc of win

QMainWindow needs to have a central widget set before other widgets can be added as a children/nested children. Once a central widget is set you can add children/layout to the central widget.

Static Methods

QMainWindow can access all the static methods defined in NodeWidget

Instance Properties

QMainWindow can access all the instance properties defined in NodeWidget

Additionally it also has the following instance properties:

win.layout

A NodeLayout representing current layout that is set on the window. If a centralWidget is set then the layout of central widget is returned.

win.centralWidget

A NodeWidget representing currently set central widget on the window.

Instance Methods

QMainWindow can access all the instance methods defined in NodeWidget

Additionally it also has the following instance methods:

win.setCentralWidget(widget)

Sets the given widget to be the main window's central widget.

  • widget NodeWidget - Any widget that inherits from NodeWidget class.