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
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
---
|
||||
sidebar_label: Component
|
||||
title: Component
|
||||
---
|
||||
|
||||
> Abstract class that is root most base class for all widgets and layouts in the NodeGui World.
|
||||
|
||||
**This class is used to add core properties to all widgets, layouts etc in NodeGui world. Currently it helps us maintain references to the native C++ instance of the widget or layout. It also helps in preventing gc of child elements of a layout or widget**
|
||||
|
||||
`Component` is an abstract class and hence no instances of the same should be created. It exists so that we can add core functionalities to all widgets and layouts easily. This is an internal class.
|
||||
|
||||
**Component is the base class for YogaWidget and NodeLayout which means all widgets and layouts inherit it aswell. Its the root base class in NodeGui world**
|
||||
|
||||
To get a clearer picture you can take a look at the Component source code here: `src/lib/core/Component/index.ts`
|
||||
|
||||
## Static Methods
|
||||
|
||||
There are no public static methods for Component.
|
||||
|
||||
## Instance Properties
|
||||
|
||||
There are no public instance properties for Component.
|
||||
|
||||
## Instance Methods
|
||||
|
||||
There are no public instance methods for Component.
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
sidebar_label: EventWidget
|
||||
title: EventWidget
|
||||
---
|
||||
|
||||
> Abstract class that adds event handling support to all widgets.
|
||||
|
||||
**This class implements an event emitter and merges it with Qt's event and signal system. It allows us to register and unregister event and signal listener at will from javascript**
|
||||
|
||||
`EventWidget` is an abstract class and hence no instances of the same should be created. It exists so that we can add event handling functionalities to all widget's easily. This is an internal class.
|
||||
|
||||
**EventWidget is the base class for NodeWidget which means all widgets inherit it aswell. It inherits from another abstract class [YogaWidget](api/YogaWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QWidget, QWidgetEvents } = require("@nodegui/nodegui");
|
||||
|
||||
const view = new QWidget();
|
||||
// addEventListener is a method from EventWidget
|
||||
view.addEventListener("MouseMove", () => {
|
||||
console.log("mouse moved");
|
||||
});
|
||||
|
||||
or;
|
||||
|
||||
// addEventListener is a method from EventWidget
|
||||
view.addEventListener(QWidgetEvents.MouseMove, () => {
|
||||
console.log("mouse moved");
|
||||
});
|
||||
```
|
||||
|
||||
EventWidget will contain all methods and properties that are useful to handle events and signals of widgets in the NodeGui world.
|
||||
|
||||
## Static Methods
|
||||
|
||||
EventWidget can access all the static methods defined in [YogaWidget](api/YogaWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
EventWidget can access all the instance properties defined in [YogaWidget](api/YogaWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
EventWidget can access all the instance methods defined in [YogaWidget](api/YogaWidget.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `widget.addEventListener(eventType, callback)`
|
||||
|
||||
Adds an event listener to the widget to listen to events that occur on a widget.
|
||||
|
||||
- `eventType` string - The event or signal you wish to listen to for the widget. Every widget exports its own enum of all possible events and signal types it can take. For example: `QWidget` exports `QWidgetEvents`, `QPushButton` exports `QPushButtonEvents`.
|
||||
|
||||
- `callback` (payload?: NativeEvent | any) => void - A callback function to invoke when an event occurs. Usually you receive a nativeEvent or a string as argument.
|
||||
|
||||
### `widget.removeEventListener(eventType, callback?)`
|
||||
|
||||
Removes the specified event listener from the widget.
|
||||
|
||||
- `eventType` string - The event or signal for which you wish to remove the listener.
|
||||
|
||||
- `callback` Function (_Optional_) - If specified the removeEventListener will remove the specified listener only, otherwise all eventlisteners of the eventType on the widget will be removed.
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
sidebar_label: FlexLayout
|
||||
title: FlexLayout
|
||||
---
|
||||
|
||||
> Custom layout to help layout child widgets using flex layout.
|
||||
|
||||
**This class is a JS wrapper around custom Qt layout implemented using [Yoga](https://github.com/facebook/yoga)**
|
||||
|
||||
A `FlexLayout` can be used to layout all child NodeGui widgets using flex.
|
||||
|
||||
**FlexLayout inherits from [NodeLayout](api/NodeLayout.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { FlexLayout, QWidget, QLabel } = require("@nodegui/nodegui");
|
||||
|
||||
const view = new QWidget();
|
||||
const layout = new FlexLayout();
|
||||
view.setLayout(layout);
|
||||
|
||||
const label = new QLabel();
|
||||
label.setText("label1");
|
||||
const label2 = new QLabel();
|
||||
label2.setText("label2");
|
||||
|
||||
layout.addWidget(label);
|
||||
layout.addWidget(label2);
|
||||
```
|
||||
|
||||
## Static Methods
|
||||
|
||||
FlexLayout can access all the static methods defined in [NodeLayout](api/NodeLayout.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
FlexLayout can access all the instance properties defined in [NodeLayout](api/NodeLayout.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
FlexLayout can access all the instance methods defined in [NodeLayout](api/NodeLayout.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `layout.addWidget(childWidget, childFlexNode?)`
|
||||
|
||||
Adds the childWidget to the layout. It calls the native method of custom FlexLayout.
|
||||
|
||||
- `childWidget` NodeWidget - child widget that needs to be added to the layout.
|
||||
- `childFlexNode` flexNode ref (_Optional_) - flexNode reference of the child widget. You can get this by calling `childWidget.getFlexNode()`.
|
||||
|
||||
### `layout.insertChildBefore(childWidget, beforeChildWidget, childFlexNode?, beforeChildFlexNode?)`
|
||||
|
||||
Adds the childWidget before another already set childWidget in the layout. It calls the native method of custom FlexLayout.
|
||||
|
||||
- `childWidget` NodeWidget - child widget that needs to be added to the layout.
|
||||
- `beforeChildWidget` NodeWidget - the widget before which the `childWidget` needs to be added in the layout.
|
||||
- `childFlexNode` flexNode ref (_Optional_) - flexNode reference of the child widget. You can get this by calling `childWidget.getFlexNode()`.
|
||||
- `beforeChildFlexNode` flexNode ref (_Optional_) - flexNode reference of the before child widget. You can get this by calling `beforeChildWidget.getFlexNode()`.
|
||||
|
||||
### `layout.removeWidget(childWidget, childFlexNode?)`
|
||||
|
||||
Removes the childWidget from the layout. It calls the native method of custom FlexLayout.
|
||||
|
||||
- `childWidget` NodeWidget - child widget that needs to be added to the layout.
|
||||
- `childFlexNode` flexNode ref (_Optional_) - flexNode reference of the child widget. You can get this by calling `childWidget.getFlexNode()`.
|
||||
|
||||
### `layout.setFlexNode(flexNode)`
|
||||
|
||||
A layout doesnt have its own flexNode. This method sets the flex Node to use for calculating position of the child widgets. Hence this should be always equal to the flex node of widget for which this layout is set. This is called internally by `widget.setLayout`.
|
||||
|
||||
- `flexNode` flexNode ref - flexNode reference of the widget for which this layout is set. You can get this by calling `widget.getFlexNode()`.
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
sidebar_label: NodeLayout
|
||||
title: NodeLayout
|
||||
---
|
||||
|
||||
> Abstract class to add functionalities common to all Layout.
|
||||
|
||||
**This class implements all methods, properties of Qt's [QLayout class](https://doc.qt.io/qt-5/qlayout.html) so that it can be inherited by all layouts**
|
||||
|
||||
`NodeLayout` is an abstract class and hence no instances of the same should be created. It exists so that we can add similar functionalities to all layout's easily. Additionally it helps in typechecking process.
|
||||
|
||||
**NodeLayout is the base class for all layouts. It inherits from another abstract class [Component](api/Component.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const {
|
||||
NodeLayout,
|
||||
NodeWidget,
|
||||
FlexLayout,
|
||||
GridLayout,
|
||||
QPushButton,
|
||||
QWidget
|
||||
} = require("@nodegui/nodegui");
|
||||
|
||||
// addChildToLayout can accept any layout since it expects NodeLayout
|
||||
const addChildToLayout = (layout: NodeLayout, widget: NodeWidget) => {
|
||||
layout.addWidget(widget);
|
||||
};
|
||||
|
||||
addChildToLayout(new FlexLayout(), new QPushButton());
|
||||
addChildToLayout(new GridLayout(), new QWidget());
|
||||
```
|
||||
|
||||
NodeLayout will list all methods and properties that are common to all layouts in the NodeGui world.
|
||||
|
||||
## Static Methods
|
||||
|
||||
NodeLayout can access all the static methods defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
NodeLayout can access all the instance properties defined in [Component](api/Component.md)
|
||||
|
||||
Additionally it also has the following instance properties:
|
||||
|
||||
### `layout.type`
|
||||
|
||||
This will return the string `layout` for all layouts.
|
||||
|
||||
## Instance Methods
|
||||
|
||||
NodeLayout can access all the instance methods defined in [Component](api/Component.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `layout.addWidget(childWidget, ...args)`
|
||||
|
||||
This is an abstract method in NodeLayout class. All Layouts inheriting from NodeLayout should implement this method.
|
||||
|
||||
- `childWidget` NodeWidget - Any widget in the NodeGui world.
|
||||
- `...args` any[] - Additional params as required by the layout.
|
||||
|
||||
### `layout.activate()`
|
||||
|
||||
Redoes the layout for parent widget of this layout if necessary. Returns true if the layout was redone.
|
||||
|
||||
### `layout.invalidate()`
|
||||
|
||||
Invalidates any cached information in this layout.
|
||||
|
||||
### `layout.update()`
|
||||
|
||||
Updates the layout for parent widget of this layout. You should generally not need to call this because it is automatically called at the most appropriate times.
|
||||
@@ -0,0 +1,210 @@
|
||||
---
|
||||
sidebar_label: NodeWidget
|
||||
title: NodeWidget
|
||||
---
|
||||
|
||||
> Abstract class to add functionalities common to all Widgets.
|
||||
|
||||
**This class implements all methods, properties of Qt's [QWidget class](https://doc.qt.io/qt-5/qwidget.html) so that it can be inherited by all widgets**
|
||||
|
||||
`NodeWidget` is an abstract class and hence no instances of the same should be created. It exists so that we can add similar functionalities to all widget's easily. Additionally it helps in typechecking process. If you wish to create a `div` like widget use [QWidget](api/QWidget.md) instead.
|
||||
|
||||
**NodeWidget is the base class for all widgets. It inherits from another abstract class [EventWidget](api/EventWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const {
|
||||
NodeWidget,
|
||||
QPushButton,
|
||||
QWidget,
|
||||
QRadioButton
|
||||
} = require("@nodegui/nodegui");
|
||||
|
||||
// showWidget can accept any widget since it expects NodeWidget
|
||||
const showWidget = (widget: NodeWidget) => {
|
||||
widget.show();
|
||||
};
|
||||
|
||||
showWidget(new QPushButton());
|
||||
showWidget(new QWidget());
|
||||
showWidget(new QRadioButton());
|
||||
```
|
||||
|
||||
NodeWidget will list all methods and properties that are common to all widgets in the NodeGui world.
|
||||
|
||||
## Static Methods
|
||||
|
||||
NodeWidget can access all the static methods defined in [EventWidget](api/EventWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
NodeWidget can access all the instance properties defined in [EventWidget](api/EventWidget.md)
|
||||
|
||||
Additionally it also has the following instance properties:
|
||||
|
||||
### `widget.layout`
|
||||
|
||||
A `NodeLayout` representing current layout that is set on the widget.
|
||||
|
||||
### `widget.type`
|
||||
|
||||
This will return the string `widget` for all widgets.
|
||||
|
||||
## Instance Methods
|
||||
|
||||
NodeWidget can access all the instance methods defined in [EventWidget](api/EventWidget.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `widget.show()`
|
||||
|
||||
Shows the widget and its children. It calls the native method [QWidget: show](https://doc.qt.io/qt-5/qwidget.html#show).
|
||||
|
||||
### `widget.resize(width, height)`
|
||||
|
||||
Resizes the widget. It calls the native method [QWidget: resize](https://doc.qt.io/qt-5/qwidget.html#resize-1).
|
||||
|
||||
- `width` number - Pixels.
|
||||
- `height` number - Pixels.
|
||||
|
||||
### `widget.close()`
|
||||
|
||||
Closes this widget. It calls the native method [QWidget: close](https://doc.qt.io/qt-5/qwidget.html#close).
|
||||
Returns true if the widget was closed; otherwise returns false.
|
||||
|
||||
### `widget.setLayout(layout)`
|
||||
|
||||
Sets the layout manager for this widget to layout. It calls the native method [QWidget: setLayout](https://doc.qt.io/qt-5/qwidget.html#setLayout).
|
||||
|
||||
- `layout` NodeLayout - Any layout that inherits from NodeLayout class.
|
||||
|
||||
### `widget.setStyleSheet(styleSheet)`
|
||||
|
||||
Sets the property that holds the widget's style sheet. It calls the native method [QWidget: styleSheet](https://doc.qt.io/qt-5/qwidget.html#styleSheet-prop).
|
||||
|
||||
- `styleSheet` string - String which holds the widget's style sheet. Make sure you create this string using `StyleSheet.create()`
|
||||
|
||||
### `widget.setCursor(cursor)`
|
||||
|
||||
Sets the window mouse cursor. It calls the native method [QWidget: setCursor](https://doc.qt.io/qt-5/qwidget.html#cursor-prop).
|
||||
|
||||
- `cursor` CursorShape - Specifies current cursor for the window [CursorShape is an enum from Qt](api/QtEnums.md)
|
||||
|
||||
### `widget.setWindowIcon(icon)`
|
||||
|
||||
Sets the window icon. It calls the native method [QWidget: setWindowIcon](https://doc.qt.io/qt-5/qwidget.html#windowIcon-prop).
|
||||
|
||||
- `icon` QIcon - Specifies icon for the window.
|
||||
|
||||
### `widget.setWindowState(state)`
|
||||
|
||||
Sets the window state. It calls the native method [QWidget: setWindowState](https://doc.qt.io/qt-5/qwidget.html#setWindowState).
|
||||
|
||||
- `state` WindowState - Specifies current state for the window [WindowState is an enum from Qt](api/QtEnums.md)
|
||||
|
||||
### `widget.setWindowTitle(title)`
|
||||
|
||||
Sets the window title property. It calls the native method [QWidget: setWindowTitle](https://doc.qt.io/qt-5/qwidget.html#windowTitle-prop).
|
||||
|
||||
- `title` string - String which holds the windows title.
|
||||
|
||||
### `widget.styleSheet()`
|
||||
|
||||
Gets the property that holds the widget's style sheet. It calls the native method [QWidget: styleSheet](https://doc.qt.io/qt-5/qwidget.html#styleSheet-prop).
|
||||
|
||||
### `widget.hide()`
|
||||
|
||||
Hides the widget and its children. It calls the native method [QWidget: hide](https://doc.qt.io/qt-5/qwidget.html#hide).
|
||||
|
||||
### `widget.move(x, y)`
|
||||
|
||||
Sets the screen position of the widget. It calls the native method [QWidget: move](https://doc.qt.io/qt-5/qwidget.html#move-1).
|
||||
|
||||
- `x` number - Pixels.
|
||||
- `y` number - Pixels.
|
||||
|
||||
### `widget.setObjectName(objectName)`
|
||||
|
||||
Sets the object name of the widget in Qt. It calls the native method [QObject: setObjectName](https://doc.qt.io/qt-5/qobject.html#objectName-prop). Object name can be analogous to `id` of an element in the web world. Using the objectName of the widget one can reference it in the Qt's stylesheet much like what we do with id in the web world.
|
||||
|
||||
- `objectName` string - String which holds the widget's object name.
|
||||
|
||||
### `widget.objectName()`
|
||||
|
||||
Gets the property that holds the widget's object name. It calls the native method [QObject: setObjectName](https://doc.qt.io/qt-5/qobject.html#objectName-prop).
|
||||
|
||||
### `widget.setMouseTracking(isMouseTracked)`
|
||||
|
||||
Sets the property that tells whether mouseTracking is enabled for the widget. It calls the native method [QWidget: mouseTracking](https://doc.qt.io/qt-5/qwidget.html#mouseTracking-prop).
|
||||
|
||||
- `isMouseTracked` boolean - Set it to true to enable mouse tracking.
|
||||
|
||||
### `widget.setEnabled(enabled)`
|
||||
|
||||
Sets the property that tells whether the widget is enabled. It calls the native method [QWidget: enabled](https://doc.qt.io/qt-5/qwidget.html#enabled-prop). In general an enabled widget handles keyboard and mouse events; a disabled widget does not.
|
||||
|
||||
- `enabled` boolean - Set it to true to enable the widget.
|
||||
|
||||
### `widget.setFixedSize(width, height)`
|
||||
|
||||
Sets both the minimum and maximum sizes of the widget. It calls the native method [QWidget: setFixedSize](https://doc.qt.io/qt-5/qwidget.html#setFixedSize).
|
||||
|
||||
- `width` number - Pixels.
|
||||
- `height` number - Pixels.
|
||||
|
||||
### `widget.setGeometry(x, y, width, height)`
|
||||
|
||||
Sets the screen position as well as size of the widget. It calls the native method [QWidget: setGeometry](https://doc.qt.io/qt-5/qwidget.html#setGeometry-1).
|
||||
|
||||
- `x` number - Pixels.
|
||||
- `y` number - Pixels.
|
||||
- `width` number - Pixels.
|
||||
- `height` number - Pixels.
|
||||
|
||||
### `widget.setMaximumSize(width, height)`
|
||||
|
||||
Sets the maximum size of the widget. It calls the native method [QWidget: setMaximumSize](https://doc.qt.io/qt-5/qwidget.html#setMaximumSize-1).
|
||||
|
||||
- `width` number - Pixels.
|
||||
- `height` number - Pixels.
|
||||
|
||||
### `widget.setMinimumSize(width, height)`
|
||||
|
||||
Sets the minimum size of the widget. It calls the native method [QWidget: setMinimumSize](https://doc.qt.io/qt-5/qwidget.html#setMinimumSize-1).
|
||||
|
||||
- `width` number - Pixels.
|
||||
- `height` number - Pixels.
|
||||
|
||||
### `widget.repaint()`
|
||||
|
||||
Repaints the widget. It calls the native method [QWidget: repaint](https://doc.qt.io/qt-5/qwidget.html#repaint).
|
||||
|
||||
### `widget.update()`
|
||||
|
||||
Updates the widget. It calls the native method [QWidget: update](https://doc.qt.io/qt-5/qwidget.html#update).
|
||||
|
||||
### `widget.pos()`
|
||||
|
||||
returns the current widget position. It calls the native method [QWidget: pos](https://doc.qt.io/qt-5/qwidget.html#pos-prop). The returned size object contains x and y coordinates in pixels.
|
||||
|
||||
### `widget.size()`
|
||||
|
||||
returns the current widget size. It calls the native method [QWidget: size](https://doc.qt.io/qt-5/qwidget.html#size-prop). The returned size object contains width and height in pixels.
|
||||
|
||||
### `widget.updateGeometry()`
|
||||
|
||||
Notifies the layout system that this widget has changed and may need to change geometry.
|
||||
|
||||
### `widget.setAttribute(attributeName, switchOn)`
|
||||
|
||||
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute. It calls the native method [QWidget: setAttribute](https://doc.qt.io/qt-5/qwidget.html#setAttribute).
|
||||
|
||||
- `attributeName` WidgetAttribute - Enum from WidgetAttribute.
|
||||
- `switchOn` - set it to true if you want to enable an attribute.
|
||||
|
||||
### `widget.testAttribute(attributeName)`
|
||||
|
||||
Returns true if attribute attribute is set on this widget; otherwise returns false. It calls the native method [QWidget: testAttribute](https://doc.qt.io/qt-5/qwidget.html#testAttribute).
|
||||
|
||||
- `attributeName` WidgetAttribute - Enum from WidgetAttribute.
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
sidebar_label: QAbstractScrollArea
|
||||
title: QAbstractScrollArea
|
||||
---
|
||||
|
||||
> Abstract class to add functionalities common to all scrollarea based widgets.
|
||||
|
||||
**This class implements all methods, properties of Qt's [QAbstractScrollArea class](https://doc.qt.io/qt-5/qabstractscrollarea.html) so that it can be inherited by all scroll based widgets**
|
||||
|
||||
`QAbstractScrollArea` is an abstract class and hence no instances of the same should be created. It exists so that we can add similar functionalities to all scrollable widget's easily. If you wish to create a scrollarea use [QScrollArea](api/QScrollArea.md) instead.
|
||||
|
||||
**QAbstractScrollArea is the base class for all widgets. It inherits from another abstract class [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
QAbstractScrollArea will list all methods and properties that are common to all scrollable widgets in the NodeGui world.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QAbstractScrollArea can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QAbstractScrollArea can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QAbstractScrollArea can access all the instance methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `widget.setViewport(widget)`
|
||||
|
||||
Sets the viewport to be the given widget. It calls the native method [QAbstractScrollArea: setViewport](https://doc.qt.io/qt-5/qabstractscrollarea.html#setViewport).
|
||||
|
||||
- `widget` NodeWidget.
|
||||
|
||||
### `widget.viewport()`
|
||||
|
||||
Returns the viewport widget (NodeWidget). It calls the native method [QAbstractScrollArea: viewport](https://doc.qt.io/qt-5/qabstractscrollarea.html#viewport).
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
sidebar_label: QAbstractSlider
|
||||
title: QAbstractSlider
|
||||
---
|
||||
|
||||
> Abstract class to add functionalities common to all slider based widgets.
|
||||
|
||||
**This class implements all methods, properties of Qt's [QAbstractSlider class](https://doc.qt.io/qt-5/qabstractslider.html) so that it can be inherited by all slider based widgets**
|
||||
|
||||
`QAbstractSlider` is an abstract class and hence no instances of the same should be created. It exists so that we can add similar functionalities to all slider widget's easily. If you wish to create a slider use [QDial](api/QDial.md) instead.
|
||||
|
||||
**QAbstractSlider is the base class for all widgets. It inherits from another abstract class [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
QAbstractSlider will list all methods and properties that are common to all slider widgets in the NodeGui world.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QAbstractSlider can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QAbstractSlider can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QAbstractSlider can access all the instance methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `widget.setSingleStep(step)`
|
||||
|
||||
Sets the step value for user arrow key slider interaction. It calls the native method [QAbstractSlider: setSingleStep](https://doc.qt.io/qt-5/qabstractslider.html#singleStep-prop).
|
||||
|
||||
- `step` number - Specified single step value.
|
||||
|
||||
### `widget.setMaximum(maximum)`
|
||||
|
||||
Sets the maximum value for slider. It calls the native method [QAbstractSlider: setMaximum](https://doc.qt.io/qt-5/qabstractslider.html#maximum-prop).
|
||||
|
||||
- `maximum` number - Specified maximum slider value.
|
||||
|
||||
### `widget.setMinimum(minimum)`
|
||||
|
||||
Sets the minimum value for slider. It calls the native method [QAbstractSlider: setMinimum](https://doc.qt.io/qt-5/qabstractslider.html#minimum-prop).
|
||||
|
||||
- `minimum` number - Specified minimum slider value.
|
||||
|
||||
### `widget.setValue(value)`
|
||||
|
||||
Sets the current value for slider. It calls the native method [QAbstractSlider: setValue](https://doc.qt.io/qt-5/qabstractslider.html#value-prop).
|
||||
|
||||
- `value` number - Specified current slider value.
|
||||
|
||||
### `widget.setOrientation(orientation)`
|
||||
|
||||
Sets the current orientation for slider. It calls the native method [QAbstractSlider: setOrientation](https://doc.qt.io/qt-5/qabstractslider.html#orientation-prop).
|
||||
|
||||
- `orientation` Orientation - Specifies visual orientation of the slider. [Orientation is an enum from Qt](api/QtEnums.md)
|
||||
|
||||
### `slider.maximum()`
|
||||
|
||||
Returns the maximum value (Number) of the slider. It calls the native method [QAbstractSlider: maximum](https://doc.qt.io/qt-5/qabstractslider.html#maximum-prop).
|
||||
|
||||
### `slider.minimum()`
|
||||
|
||||
Returns the minimum value (Number) of the slider. It calls the native method [QAbstractSlider: minimum](https://doc.qt.io/qt-5/qabstractslider.html#minimum-prop).
|
||||
|
||||
### `slider.value()`
|
||||
|
||||
Returns the current value (Number) of the slider. It calls the native method [QAbstractSlider: value](https://doc.qt.io/qt-5/qabstractslider.html#value-prop).
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
sidebar_label: QApplication
|
||||
title: QApplication
|
||||
---
|
||||
|
||||
> QApplication is the root object for the entire application. It manages app level settings.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QApplication class](https://doc.qt.io/qt-5/qapplication.html)**
|
||||
|
||||
The QApplication class manages the GUI application's control flow and main settings. In NodeGui you will never create an instance of it manually. NodeGui's internal runtime `Qode` does it for you on app start. You can access the initialised QApplication though if needed.
|
||||
|
||||
**QApplication inherits from [Component](api/Component.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```js
|
||||
const { QApplication } = require("@nodegui/nodegui");
|
||||
|
||||
const qApp = QApplication.instance();
|
||||
qApp.quit();
|
||||
```
|
||||
|
||||
## Static Methods
|
||||
|
||||
QApplication can access all the static methods defined in [Component](api/Component.md). Additionally it also has the following static methods.
|
||||
|
||||
### `QApplication.instance()`
|
||||
|
||||
Returns the already initialised QApplication instance. It calls the native method [QApplication: instance](https://doc.qt.io/qt-5/qcoreapplication.html#instance).
|
||||
|
||||
### `QApplication.clipboard()`
|
||||
|
||||
Returns the object for interacting with the clipboard. It calls the native method [QApplication: clipboard](https://doc.qt.io/qt-5/qguiapplication.html#clipboard). See QClipboard.
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QApplication can access all the instance properties defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QApplication can access all the instance methods defined in [Component](api/Component.md). Additionally it also has the following instance methods:
|
||||
|
||||
### `qApp.quit()`
|
||||
|
||||
Quits the entire app. It calls the native method [QApplication: quit](https://doc.qt.io/qt-5/qcoreapplication.html#quit).
|
||||
|
||||
### `qApp.exit(returnCode)`
|
||||
|
||||
Tells the application to exit with a return code. It calls the native method [QApplication: exit](https://doc.qt.io/qt-5/qcoreapplication.html#exit).
|
||||
|
||||
- `returnCode` number - The exit code while quitting the app.
|
||||
|
||||
### `qApp.processEvents()`
|
||||
|
||||
Processes all pending events for the calling thread . It calls the native method [QApplication: processEvents](https://doc.qt.io/qt-5/qcoreapplication.html#processEvents).
|
||||
|
||||
### `qApp.exec()`
|
||||
|
||||
> We will never call this method in NodeGui, since Qode will execute this function for us. It exists for experiments only.
|
||||
|
||||
Enters the main event loop and waits until exit() is called. Returns the value that was passed to exit() (which is 0 if exit() is called via quit()). It calls the native method [QApplication: exec](https://doc.qt.io/qt-5/qcoreapplication.html#exec).
|
||||
|
||||
Returns the exit code after app exits.
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
sidebar_label: QCheckBox
|
||||
title: QCheckBox
|
||||
---
|
||||
|
||||
> Create and control checkbox.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QCheckBox class](https://doc.qt.io/qt-5/qcheckbox.html)**
|
||||
|
||||
A `QCheckBox` provides ability to add and manipulate native checkbox widgets.
|
||||
|
||||
**QCheckBox inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QCheckBox } = require("@nodegui/nodegui");
|
||||
|
||||
const checkbox = new QCheckBox();
|
||||
checkbox.setText("Hello");
|
||||
```
|
||||
|
||||
### `new QCheckBox(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QCheckBox can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QCheckBox can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QCheckBox can access all the instance methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `checkbox.setText(text)`
|
||||
|
||||
Sets the given text to the checkbox.
|
||||
|
||||
- `text` string
|
||||
|
||||
### `checkbox.isChecked()`
|
||||
|
||||
returns whether the checkbox is checked or not. It calls the native method [QAbstractButton: isChecked](https://doc.qt.io/qt-5/qabstractbutton.html#checked-prop).
|
||||
|
||||
### `checkbox.setChecked(check)`
|
||||
|
||||
This property holds whether the button is checked. It calls the native method [QAbstractButton: setChecked](https://doc.qt.io/qt-5/qabstractbutton.html#checked-prop).
|
||||
|
||||
- `check` boolean
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
sidebar_label: QClipboard
|
||||
title: QClipboard
|
||||
---
|
||||
|
||||
> The QClipboard class provides access to the window system clipboard.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QClipboard class](https://doc.qt.io/qt-5/QClipboard.html)**
|
||||
|
||||
**QClipboard inherits from [Component](api/Component.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const {
|
||||
QClipboard,
|
||||
QClipboardMode,
|
||||
QApplication
|
||||
} = require("@nodegui/nodegui");
|
||||
|
||||
const clipboard = QApplication.clipboard();
|
||||
const text = clipboard.text(QClipboardMode.Clipboard);
|
||||
```
|
||||
|
||||
## Static Methods
|
||||
|
||||
QClipboard can access all the static methods defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QClipboard can access all the instance properties defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QClipboard can access all the instance methods defined in [Component](api/Component.md). Additionally it has:
|
||||
|
||||
### `clipboard.clear(mode)`
|
||||
|
||||
Clear the clipboard contents. It calls the native method [QClipboard: clear](https://doc.qt.io/qt-5/qclipboard.html#clear).
|
||||
|
||||
- `mode` - This enum type is used to control which part of the system clipboard is used. See https://doc.qt.io/qt-5/qclipboard.html#Mode-enum
|
||||
|
||||
### `clipboard.setText(text, mode)`
|
||||
|
||||
Copies text into the clipboard as plain text. It calls the native method [QClipboard: setText](https://doc.qt.io/qt-5/qclipboard.html#setText).
|
||||
|
||||
- `text` - The text you want to copy to clipboard.
|
||||
|
||||
- `mode` - This enum type is used to control which part of the system clipboard is used. See https://doc.qt.io/qt-5/qclipboard.html#Mode-enum
|
||||
|
||||
### `clipboard.text(mode)`
|
||||
|
||||
Returns the clipboard text as plain text, or an empty string if the clipboard does not contain any text. It calls the native method [QClipboard: text](https://doc.qt.io/qt-5/qclipboard.html#text).
|
||||
|
||||
- `mode` - This enum type is used to control which part of the system clipboard is used. See https://doc.qt.io/qt-5/qclipboard.html#Mode-enum
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
sidebar_label: QCursor
|
||||
title: QCursor
|
||||
---
|
||||
|
||||
> The QCursor class provides scalable icons in different modes and states.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QCursor class](https://doc.qt.io/qt-5/qcursor.html)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QCursor } = require("@nodegui/nodegui");
|
||||
|
||||
const cursor = new QCursor();
|
||||
```
|
||||
|
||||
### `new QCursor(cursor)`
|
||||
|
||||
- `cursor` CursorShape (_optional_). Defines shape for the cursor. [CursorShape is an enum from Qt](api/QtEnums.md)
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
sidebar_label: QDial
|
||||
title: QDial
|
||||
---
|
||||
|
||||
> Create and control dial slider widgets.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QDial class](https://doc.qt.io/qt-5/qdial.html)**
|
||||
|
||||
A `QDial` provides ability to add and manipulate native dial slider widgets.
|
||||
|
||||
**QDial inherits from [QAbstractSlider](api/QAbstractSlider.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QDial } = require("@nodegui/nodegui");
|
||||
|
||||
const dial = new QDial();
|
||||
```
|
||||
|
||||
### `new QDial(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QDial can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QDial can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QDial can access all the instance methods defined in [NodeWidget](api/NodeWidget.md). Additionally it also has the following instance methods:
|
||||
|
||||
### `dial.setNotchesVisible(visible)`
|
||||
|
||||
Sets the visibility of notches drawn around the dial. It calls the native method [QDial: setNotchesVisible](https://doc.qt.io/qt-5/qdial.html#notchTarget-prop).
|
||||
|
||||
- `visible` boolean - Set the value as current notch visibility.
|
||||
|
||||
### `dial.setWrapping(on)`
|
||||
|
||||
Sets the ability to wrap arrow around the dial instead of limiting it to upper part of the dial. It calls the native method [QDial: setWrapping](https://doc.qt.io/qt-5/qdial.html#wrapping-prop).
|
||||
|
||||
- `on` boolean - Set the value as current wrapping setting.
|
||||
|
||||
### `dial.setNotchTarget(target)`
|
||||
|
||||
Sets the number of pixels between dial notches. It calls the native method [QDial: setNotchTarget](https://doc.qt.io/qt-5/qdial.html#notchTarget-prop).
|
||||
|
||||
- `target` number - Specifies number of pixels between notches.
|
||||
|
||||
### `dial.notchTarget()`
|
||||
|
||||
Returns the current number of pixels between dial notches. It calls the native method [QDial: notchTarget](https://doc.qt.io/qt-5/qdial.html#notchTarget-prop).
|
||||
|
||||
### `dial.notchesVisible()`
|
||||
|
||||
Returns the visibility status (Boolean) of dial notches. It calls the native method [QDial: notchesVisible](https://doc.qt.io/qt-5/qdial.html#notchesVisible-prop).
|
||||
|
||||
### `dial.notchesVisible()`
|
||||
|
||||
Returns the visibility status (Boolean) of dial notches. It calls the native method [QDial: notchesVisible](https://doc.qt.io/qt-5/qdial.html#notchesVisible-prop).
|
||||
|
||||
### `dial.wrapping()`
|
||||
|
||||
Returns the current wrapping (Boolean) state of the dial. It calls the native method [QDial: wrapping](https://doc.qt.io/qt-5/qdial.html#wrapping-prop).
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
sidebar_label: QGridLayout
|
||||
title: QGridLayout
|
||||
---
|
||||
|
||||
> The QGridLayout class lays out widgets in a grid.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QGridLayout](https://doc.qt.io/qt-5/qgridlayout.html)**
|
||||
|
||||
**QGridLayout inherits from [NodeLayout](api/NodeLayout.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QGridLayout, QWidget, QLabel } = require("@nodegui/nodegui");
|
||||
|
||||
const view = new QWidget();
|
||||
const layout = new QGridLayout();
|
||||
view.setLayout(layout);
|
||||
|
||||
const label = new QLabel();
|
||||
label.setText("label1");
|
||||
const label2 = new QLabel();
|
||||
label2.setText("label2");
|
||||
|
||||
layout.addWidget(label);
|
||||
layout.addWidget(label2);
|
||||
```
|
||||
|
||||
## Static Methods
|
||||
|
||||
QGridLayout can access all the static methods defined in [NodeLayout](api/NodeLayout.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QGridLayout can access all the instance properties defined in [NodeLayout](api/NodeLayout.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QGridLayout can access all the instance methods defined in [NodeLayout](api/NodeLayout.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `layout.addWidget(childWidget)`
|
||||
|
||||
Adds the childWidget to the layout. It calls the native method QGridLayout [QGridLayout: addWidget](https://doc.qt.io/qt-5/qwidget.html#show).
|
||||
|
||||
- `childWidget` NodeWidget - child widget that needs to be added to the layout.
|
||||
|
||||
### `layout.removeWidget(childWidget)`
|
||||
|
||||
Removes the childWidget from the layout. It calls the native method of custom QGridLayout. [QGridLayout: removeWidget](https://doc.qt.io/qt-5/qlayout.html#removeWidget).
|
||||
|
||||
- `childWidget` NodeWidget - child widget that needs to be added to the layout.
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
sidebar_label: QIcon
|
||||
title: QIcon
|
||||
---
|
||||
|
||||
> The QIcon class provides scalable icons in different modes and states.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QIcon class](https://doc.qt.io/qt-5/qicon.html)**
|
||||
|
||||
**QIcon inherits from [Component](api/Component.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QIcon } = require("@nodegui/nodegui");
|
||||
|
||||
const imageUrl = "path/to/png";
|
||||
const icon = new QIcon(imageUrl);
|
||||
```
|
||||
|
||||
### `new QIcon(imageUrl?)`
|
||||
|
||||
- `imageUrl` string (_optional_). Absolute path of the image that needs to be loaded in the memory.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QIcon can access all the static methods defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QIcon can access all the instance properties defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QIcon can access all the instance methods defined in [Component](api/Component.md)
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `icon.pixmap(width, height, mode?, state?)` (v0.1.10 & up)
|
||||
|
||||
Returns a pixmap with the requested size, mode, and state, generating one if necessary. The pixmap might be smaller than requested, but never larger.
|
||||
. It calls the native method [QIcon: pixmap](https://doc.qt.io/qt-5/qicon.html#pixmap-3).
|
||||
|
||||
- `width`: number,
|
||||
- `height`: number
|
||||
- `mode?`: QIconMode
|
||||
- `state?`: QIconState
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
sidebar_label: QLabel
|
||||
title: QLabel
|
||||
---
|
||||
|
||||
> Create and control text.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QLabel class](https://doc.qt.io/qt-5/qlabel.html)**
|
||||
|
||||
A `QLabel` provides ability to add and manipulate text.
|
||||
|
||||
**QLabel inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QLabel } = require("@nodegui/nodegui");
|
||||
|
||||
const label = new QLabel();
|
||||
label.setText("Hello");
|
||||
```
|
||||
|
||||
### `new QLabel(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QLabel can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QLabel can access all the instance properties defined in [NodeWidget](api/NodeWidget.md). Additionally it also has the following instance properties:
|
||||
|
||||
### `label.pixmap`
|
||||
|
||||
The pixmap currently set on this label.
|
||||
|
||||
### `label.text`
|
||||
|
||||
the current text set on the label.
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QLabel can access all the instance methods defined in [NodeWidget](api/NodeWidget.md). Additionally it also has the following instance methods:
|
||||
|
||||
### `label.setText(text)`
|
||||
|
||||
Sets the given text to the label.
|
||||
|
||||
- `text` string
|
||||
|
||||
### `label.setWordWrap(on)`
|
||||
|
||||
- `on` boolean - If true it sets wordwrap on the label
|
||||
|
||||
### `label.setPixmap(pixMap)`
|
||||
|
||||
Images in the form of a pixmap can be set as the label content
|
||||
|
||||
- `pixMap` [QPixmap](api/QPixmap.md) - Allows to set image content in the form of a QPixmap on the label
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
sidebar_label: QLineEdit
|
||||
title: QLineEdit
|
||||
---
|
||||
|
||||
> Create and control editable text field.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QLineEdit class](https://doc.qt.io/qt-5/qlineedit.html)**
|
||||
|
||||
A `QLineEdit` provides ability to add and manipulate native editable text field widgets.
|
||||
|
||||
**QLineEdit inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QLineEdit } = require("@nodegui/nodegui");
|
||||
|
||||
const lineEdit = new QLineEdit();
|
||||
```
|
||||
|
||||
### `new QLineEdit(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QLineEdit can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QLineEdit can access all the instance properties defined in [NodeWidget](api/NodeWidget.md). Additionally it also has the following instance properties:
|
||||
|
||||
### `lineEdit.placeholderText`
|
||||
|
||||
The placeholder text set on the lineEdit.
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QLineEdit can access all the instance methods defined in [NodeWidget](api/NodeWidget.md). Additionally it also has the following instance methods:
|
||||
|
||||
### `lineEdit.setText(text)`
|
||||
|
||||
Sets the given text to the lineEdit.
|
||||
|
||||
- `text` string
|
||||
|
||||
### `lineEdit.setPlaceholderText(text)`
|
||||
|
||||
Sets the given text to the lineEdit's placeholder.
|
||||
|
||||
- `text` string
|
||||
|
||||
### `lineEdit.text()`
|
||||
|
||||
Returns the currently set text from native lineEdit widget.
|
||||
|
||||
### `lineEdit.setReadOnly(isReadOnly)`
|
||||
|
||||
Sets the lineEdit to be read only. lineEdit property holds whether the line edit is read only.
|
||||
|
||||
- `isReadOnly` boolean
|
||||
|
||||
### `lineEdit.clear()`
|
||||
|
||||
Clears the lineEdit.
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
sidebar_label: QMainWindow
|
||||
title: QMainWindow
|
||||
---
|
||||
|
||||
> Create and control windows.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QMainWindow class](https://doc.qt.io/qt-5/qmainwindow.html)**
|
||||
|
||||
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](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
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](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QMainWindow can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
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](api/NodeWidget.md)
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
sidebar_label: QPixmap
|
||||
title: QPixmap
|
||||
---
|
||||
|
||||
> The QPixmap class helps hold an image in the form of off-screen image representation.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QPixmap class](https://doc.qt.io/qt-5/qpixmap.html)**
|
||||
|
||||
A `QPixmap` provides ability to store an image in the memory.
|
||||
|
||||
**QPixmap inherits from [Component](api/Component.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QPixmap } = require("@nodegui/nodegui");
|
||||
|
||||
const imageUrl = "path/to/png";
|
||||
const pixMap = new QPixmap(imageUrl);
|
||||
```
|
||||
|
||||
### `new QPixmap(imageUrl?)`
|
||||
|
||||
- `imageUrl` string (_optional_). Absolute path of the image that needs to be loaded in the memory.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QPixmap can access all the static methods defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QPixmap can access all the instance properties defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QPixmap can access all the instance methods defined in [Component](api/Component.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `pixMap.load(imageUrl)`
|
||||
|
||||
loads an image from the url into memory as a Pixmap.
|
||||
returns true if load was successful otherwise returns false.
|
||||
|
||||
- `imageUrl` string (_optional_). Absolute path of the image that needs to be loaded in the memory.
|
||||
|
||||
#### `pixMap.save(fileName, format)`
|
||||
|
||||
Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. Returns `true` if successful; otherwise returns false.
|
||||
|
||||
If format is 0, an image format will be chosen from fileName's suffix.
|
||||
|
||||
See also [Reading and Writing Image Files.](https://doc.qt.io/qt-5/qpixmap.html#reading-and-writing-image-files).
|
||||
|
||||
- `fileName` string.
|
||||
- `format` string. (_optional_).
|
||||
|
||||
#### `pixMap.scaled(width, height, aspectRatioMode?)`
|
||||
|
||||
Scales the pixmap to provided height and width with respect to aspectRatioMode.
|
||||
This method doesnt mutate this pixmap and rather returns a new pixmap with new height and width.
|
||||
|
||||
- `width` number. Width in pixels for new pixmap.
|
||||
- `height` number. Height in pixels for new pixmap.
|
||||
- `aspectRatioMode` AspectRatioMode (_optional_). Specifies how scaling should happen. [AspectRatio is an enum from Qt](api/QtEnums.md)
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_label: QPlainTextEdit
|
||||
title: QPlainTextEdit
|
||||
---
|
||||
|
||||
> Used to edit and display plain text.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QPlainTextEdit class](https://doc.qt.io/qt-5/qplaintextedit.html)**
|
||||
|
||||
A `QPlainTextEdit` provides ability to add and manipulate native editable text field widgets.
|
||||
|
||||
**QPlainTextEdit inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QPlainTextEdit } = require("@nodegui/nodegui");
|
||||
|
||||
const plainTextEdit = new QPlainTextEdit();
|
||||
```
|
||||
|
||||
### `new QPlainTextEdit(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QPlainTextEdit can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QPlainTextEdit can access all the instance properties defined in [NodeWidget](api/NodeWidget.md).
|
||||
|
||||
### `plainTextEdit.placeholderText`
|
||||
|
||||
The placeholder text set on the plainTextEdit.
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QPlainTextEdit can access all the instance methods defined in [NodeWidget](api/NodeWidget.md).
|
||||
|
||||
### `plainTextEdit.setPlainText(text)`
|
||||
|
||||
Sets the given text to the plainTextEdit. It calls the native method [QPlainTextEdit: setPlainText](https://doc.qt.io/qt-5/qplaintextedit.html#setPlainText).
|
||||
|
||||
- `text` string
|
||||
|
||||
### `plainTextEdit.setPlaceholderText(text)`
|
||||
|
||||
Sets the given text to the plainTextEdit's placeholder.
|
||||
|
||||
- `text` string
|
||||
|
||||
### `plainTextEdit.toPlainText()`
|
||||
|
||||
Returns the text of the text edit as plain text. [QPlainTextEdit: toPlainText](https://doc.qt.io/qt-5/qplaintextedit.html#toPlainText).
|
||||
|
||||
### `plainTextEdit.setReadOnly(isReadOnly)`
|
||||
|
||||
Sets the plainTextEdit to be read only. [QPlainTextEdit: isReadOnly](https://doc.qt.io/qt-5/qplaintextedit.html#readOnly-prop).
|
||||
|
||||
### `plainTextEdit.clear()`
|
||||
|
||||
Deletes all the text in the text edit.[QPlainTextEdit: clear](https://doc.qt.io/qt-5/qplaintextedit.html#clear).
|
||||
|
||||
### `plainTextEdit.setWordWrapMode(mode)`
|
||||
|
||||
This property holds the mode QPlainTextEdit will use when wrapping text by words.[QPlainTextEdit: setWordWrapMode](https://doc.qt.io/qt-5/qplaintextedit.html#wordWrapMode-prop).
|
||||
|
||||
- mode: QTextOptionWrapMode
|
||||
|
||||
### `plainTextEdit.wordWrapMode()`
|
||||
|
||||
returns word wrap mode. [QPlainTextEdit: wordWrapMode](https://doc.qt.io/qt-5/qplaintextedit.html#wordWrapMode-prop).
|
||||
|
||||
### `plainTextEdit.setLineWrapMode(mode)`
|
||||
|
||||
This property holds the line wrap mode. [QPlainTextEdit: setLineWrapMode](https://doc.qt.io/qt-5/qplaintextedit.html#lineWrapMode-prop).
|
||||
|
||||
- mode: LineWrapMode
|
||||
|
||||
### `plainTextEdit.lineWrapMode()`
|
||||
|
||||
returns line wrap mode. [QPlainTextEdit: setLineWrapMode](https://doc.qt.io/qt-5/qplaintextedit.html#lineWrapMode-prop).
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
sidebar_label: QProgressBar
|
||||
title: QProgressBar
|
||||
---
|
||||
|
||||
> Create and control progress bar widgets.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QProgressBar class](https://doc.qt.io/qt-5/qprogressbar.html)**
|
||||
|
||||
A `QProgressBar` provides ability to add and manipulate native progress bar widgets.
|
||||
|
||||
**QProgressBar inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QProgressBar } = require("@nodegui/nodegui");
|
||||
|
||||
const progressBar = new QProgressBar();
|
||||
```
|
||||
|
||||
### `new QProgressBar(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QProgressBar can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QProgressBar can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QProgressBar can access all the instance methods defined in [NodeWidget](api/NodeWidget.md). Additionally it also has the following instance methods:
|
||||
|
||||
### `progressBar.setValue(value)`
|
||||
|
||||
Sets the current value of the progressBar. It calls the native method [QProgressBar: setValue](https://doc.qt.io/qt-5/qprogressbar.html#value-prop).
|
||||
|
||||
- `value` number - Set the value as current value
|
||||
|
||||
### `progressBar.setMaximum(max)`
|
||||
|
||||
Sets the max value of the progressBar. It calls the native method [QProgressBar: setMaximum](https://doc.qt.io/qt-5/qprogressbar.html#maximum-prop).
|
||||
|
||||
- `max` number - Set the value as max value of the progress bar.
|
||||
|
||||
### `progressBar.setMinimum(min)`
|
||||
|
||||
Sets the min value of the progressBar. It calls the native method [QProgressBar: setMinimum](https://doc.qt.io/qt-5/qprogressbar.html#minimum-prop).
|
||||
|
||||
- `min` number - Set the value as min value of the progress bar.
|
||||
|
||||
### `progressBar.setOrientation(orientation)`
|
||||
|
||||
Sets the orientation of the progressBar. It calls the native method [QProgressBar: setOrientation](https://doc.qt.io/qt-5/qprogressbar.html#orientation-prop).
|
||||
|
||||
- `orientation` Orientation - Specifies visual orientation of the progress bar. [Orientation is an enum from Qt](api/QtEnums.md)
|
||||
|
||||
### `progressBar.value()`
|
||||
|
||||
Returns the current value (Number) of the progressBar. It calls the native method [QProgressBar: value](https://doc.qt.io/qt-5/qprogressbar.html#value-prop).
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
sidebar_label: QPushButton
|
||||
title: QPushButton
|
||||
---
|
||||
|
||||
> Create and control buttons.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QPushButton class](https://doc.qt.io/qt-5/qpushbutton.html)**
|
||||
|
||||
A `QPushButton` provides ability to add and manipulate native button widgets.
|
||||
|
||||
**QPushButton inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QPushButton } = require("@nodegui/nodegui");
|
||||
|
||||
const button = new QPushButton();
|
||||
button.setText("Hello");
|
||||
```
|
||||
|
||||
### `new QPushButton(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QPushButton can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QPushButton can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QPushButton can access all the instance methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `button.setText(text)`
|
||||
|
||||
Sets the given text to the button.
|
||||
|
||||
- `text` string
|
||||
|
||||
### `button.setFlat(isFlat)`
|
||||
|
||||
Sets whether the button border is raised.
|
||||
|
||||
- `isFlat` boolean
|
||||
|
||||
### `button.setIcon(icon)`
|
||||
|
||||
Sets an icon in the button.
|
||||
|
||||
- `icon` QIcon
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
sidebar_label: QRadioButton
|
||||
title: QRadioButton
|
||||
---
|
||||
|
||||
> Create and control radio button.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QRadioButton class](https://doc.qt.io/qt-5/qradiobutton.html)**
|
||||
|
||||
A `QRadioButton` provides ability to add and manipulate native radio button widgets.
|
||||
|
||||
**QRadioButton inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QRadioButton } = require("@nodegui/nodegui");
|
||||
|
||||
const radioButton = new QRadioButton();
|
||||
radioButton.setText("Hello");
|
||||
```
|
||||
|
||||
### `new QRadioButton(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QRadioButton can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QRadioButton can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QRadioButton can access all the instance methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `radioButton.setText(text)`
|
||||
|
||||
Sets the given text to the radioButton.
|
||||
|
||||
- `text` string
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
sidebar_label: QScrollArea
|
||||
title: QScrollArea
|
||||
---
|
||||
|
||||
> A `QScrollArea` provides a scrolling view onto another widget.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QScrollArea class](https://doc.qt.io/qt-5/qscrollarea.html)**
|
||||
|
||||
**QScrollArea inherits from [QAbstractScrollArea](api/QAbstractScrollArea.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QScrollArea } = require("@nodegui/nodegui");
|
||||
|
||||
const scrollArea = new QScrollArea();
|
||||
scrollArea.setInlineStyle("flex: 1; width:'100%';");
|
||||
|
||||
const imageLabel = new QLabel();
|
||||
const pixmap = new QPixmap(
|
||||
path.resolve(__dirname, "../extras/assets/kitchen.png")
|
||||
);
|
||||
imageLabel.setPixmap(pixmap);
|
||||
|
||||
scrollArea.setWidget(imageLabel);
|
||||
```
|
||||
|
||||
### `new QScrollArea(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QScrollArea can access all the static methods defined in [QAbstractScrollArea](api/QAbstractScrollArea.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QScrollArea can access all the instance properties defined in [QAbstractScrollArea](api/QAbstractScrollArea.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QScrollArea can access all the instance methods defined in [QAbstractScrollArea](api/QAbstractScrollArea.md). Additionally it also has the following instance methods:
|
||||
|
||||
### `scrollArea.setWidget(widget)`
|
||||
|
||||
Sets the scroll area's widget. It calls the native method [QScrollArea: setWidget](https://doc.qt.io/qt-5/qscrollarea.html#setWidget).
|
||||
|
||||
- `widget` NodeWidget - Any widget you want to enclose in a scroll area.
|
||||
@@ -0,0 +1,82 @@
|
||||
---
|
||||
sidebar_label: QSpinBox
|
||||
title: QSpinBox
|
||||
---
|
||||
|
||||
> Create and control spin box widgets.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QSpinBox class](https://doc.qt.io/qt-5/qspinbox.html)**
|
||||
|
||||
A `QSpinBox` provides ability to add and manipulate native spin box widgets.
|
||||
|
||||
**QSpinBox inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QSpinBox } = require("@nodegui/nodegui");
|
||||
|
||||
const spinBox = new QSpinBox();
|
||||
```
|
||||
|
||||
### `new QSpinBox(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QSpinBox can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QSpinBox can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QSpinBox can access all the instance methods defined in [NodeWidget](api/NodeWidget.md). Additionally it also has the following instance methods:
|
||||
|
||||
### `spinBox.setValue(val)`
|
||||
|
||||
Sets the current value of the spinBox. It calls the native method [QSpinBox: setValue](https://doc.qt.io/qt-5/qspinbox.html#value-prop).
|
||||
|
||||
- `val` number - Set the value as current value
|
||||
|
||||
### `spinBox.setRange(minimum, maximum)`
|
||||
|
||||
Sets the min/max value of the spinBox. It calls the native method [QSpinBox: setRange](https://doc.qt.io/qt-5/qspinbox.html#setRange).
|
||||
|
||||
- `max` number - Set the value as max value of the progress bar.
|
||||
|
||||
### `spinBox.setPrefix(prefix)`
|
||||
|
||||
Sets the prefix of the spinBox. It calls the native method [QSpinBox: setPrefix](https://doc.qt.io/qt-5/qspinbox.html#prefix-prop).
|
||||
|
||||
- `prefix` string - Specifies prefix content shows before the spinBox value. [Prefix is an enum from Qt](api/QtEnums.md)
|
||||
|
||||
### `spinBox.setSuffix(suffix)`
|
||||
|
||||
Sets the suffix of the spinBox. It calls the native method [QSpinBox: setSuffix](https://doc.qt.io/qt-5/qspinbox.html#suffix-prop).
|
||||
|
||||
- `suffix` string - Specifies suffix content shows after the spinBox value. [Suffix is an enum from Qt](api/QtEnums.md)
|
||||
|
||||
### `spinBox.setSingleStep(val)`
|
||||
|
||||
Sets the single step value of the spinBox. It calls the native method [QSpinBox: setSingleStep](https://doc.qt.io/qt-5/qspinbox.html#singleStep-prop).
|
||||
|
||||
- `val` number - Specifies amount value changes with each step. [Suffix is an enum from Qt](api/QtEnums.md)
|
||||
|
||||
### `spinBox.cleanText()`
|
||||
|
||||
Returns the text content (String) of the spinBox excluding any prefix, suffix, or leading or trailing whitespace. It calls the native method [QSpinBox: value](https://doc.qt.io/qt-5/qspinbox.html#minimum-prop).
|
||||
|
||||
### `spinBox.minimum()`
|
||||
|
||||
Returns the minimum value (Number) of the spinBox. It calls the native method [QSpinBox: value](https://doc.qt.io/qt-5/qspinbox.html#minimum-prop).
|
||||
|
||||
### `spinBox.maximum()`
|
||||
|
||||
Returns the maximum value (Number) of the spinBox. It calls the native method [QSpinBox: value](https://doc.qt.io/qt-5/qspinbox.html#maximum-prop).
|
||||
|
||||
### `spinBox.value()`
|
||||
|
||||
Returns the current value (Number) of the spinBox. It calls the native method [QSpinBox: value](https://doc.qt.io/qt-5/qspinbox.html#value-prop).
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
sidebar_label: QTabWidget
|
||||
title: QTabWidget
|
||||
---
|
||||
|
||||
Will be available from NodeGUI v0.1.10 and up
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
sidebar_label: QWidget
|
||||
title: QWidget
|
||||
---
|
||||
|
||||
> Create and control views.
|
||||
|
||||
**This class is a JS wrapper around Qt's [QWidget class](https://doc.qt.io/qt-5/qwidget.html)**
|
||||
|
||||
A `QWidget` can be used to encapsulate other widgets and provide structure. It functions similar to a `div` in the web world.
|
||||
|
||||
**QWidget inherits from [NodeWidget](api/NodeWidget.md)**
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const { QWidget } = require("@nodegui/nodegui");
|
||||
|
||||
const view = new QWidget();
|
||||
view.setObjectName("container"); //Similar to setting `id` on the web
|
||||
view.setLayout(new FlexLayout());
|
||||
```
|
||||
|
||||
### `new QWidget(parent?)`
|
||||
|
||||
- `parent` NodeWidget (_optional_). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
QWidget can access all the static methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
QWidget can access all the instance properties defined in [NodeWidget](api/NodeWidget.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
QWidget can access all the instance methods defined in [NodeWidget](api/NodeWidget.md)
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
sidebar_label: Qt Enums
|
||||
title: Qt Enums
|
||||
---
|
||||
|
||||
## Enums from Qt
|
||||
|
||||
For a complete list of Enums that we can use from Javascript see file
|
||||
|
||||
Qt enums: [`src/lib/QtEnums/index.ts`](https://github.com/nodegui/nodegui/blob/master/src/lib/QtEnums/index.ts) in the NodeGui repo.
|
||||
|
||||
All the enums in this file can be imported directly from `@nodegui/@nodegui`.
|
||||
|
||||
### Example
|
||||
|
||||
```js
|
||||
import { AspectRatioMode } from "@nodegui/nodegui";
|
||||
```
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
sidebar_label: YogaWidget
|
||||
title: YogaWidget
|
||||
---
|
||||
|
||||
> Abstract class to add common functionality related to Flex layout to all Widgets.
|
||||
|
||||
**This class implements methods related to flex layout required to be present in all widgets**
|
||||
|
||||
`YogaWidget` is an abstract class and hence no instances of the same should be created. It exists so that we can add similar functionalities related to flex layout to all widget's easily. We implement flex layout using a library called [Yoga](https://github.com/facebook/yoga). As part of yoga every widget needs to store its own flex properties such as alignItems, flexDirection etc. This is done with the help of YogaWidget.
|
||||
|
||||
**YogaWidget is the base class for EventWidget which means all widgets inherit it aswell. It inherits from another abstract class [Component](api/Component.md)**
|
||||
|
||||
```javascript
|
||||
const { QWidget } = require("@nodegui/nodegui");
|
||||
|
||||
const view = new QWidget();
|
||||
// getFlexNode is a method from YogaWidget
|
||||
const flexNode = view.getFlexNode();
|
||||
```
|
||||
|
||||
YogaWidget helps in storing all flex properties of a widget.
|
||||
|
||||
## Static Methods
|
||||
|
||||
YogaWidget can access all the static methods defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Properties
|
||||
|
||||
YogaWidget can access all the instance properties defined in [Component](api/Component.md)
|
||||
|
||||
## Instance Methods
|
||||
|
||||
YogaWidget can access all the instance methods defined in [Component](api/Component.md)
|
||||
|
||||
Additionally it also has the following instance methods:
|
||||
|
||||
### `widget.getFlexNode()`
|
||||
|
||||
Returns a native reference to the flex node used in c++ instance for the widget. This is not a regular javascript object and hence no methods or properties can be accessed from it. It exists so that we pass around a widgets flex node to layouts, etc.
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
sidebar_label: process
|
||||
title: process
|
||||
---
|
||||
|
||||
> Extensions to process object.
|
||||
|
||||
Qode's `process` object is extended from the
|
||||
[Node.js `process` object](https://nodejs.org/api/process.html).
|
||||
It adds the following properties :
|
||||
|
||||
## Properties
|
||||
|
||||
### `process.versions.qode` _Readonly_
|
||||
|
||||
A `String` representing Qode's version string. Qode is a lightly modified version of NodeJs that allows running Qt and NodeJs under a single process.
|
||||
|
||||
### `process.versions.qt(compiled)` _Readonly_
|
||||
|
||||
A `String` representing Qt version used when compile Qode binary. This can be useful to know which version of Qt is binary compatible with the version of Qode you are running. This is useful when running qode with a different version of Qt than what it was compiled with.
|
||||
|
||||
### `process.versions.qt(runtime)` _Readonly_
|
||||
|
||||
A `String` representing Qt version of the Qt library loaded during runtime. This can be useful to know which version of Qt you are using at runtime as compared to the version of Qt used when Qode was compiled.This is possible since Qt is dynamically linked to Qode and you could replace the Qt dynamic libraries with any binary compatible library. Hence, this is useful when running qode with a different version of Qt than what it was compiled with.
|
||||
@@ -0,0 +1,69 @@
|
||||
---
|
||||
sidebar_label: Synopsis
|
||||
title: Synopsis
|
||||
---
|
||||
|
||||
> How to use Node.js and NodeGui's APIs.
|
||||
|
||||
All of [Node.js's built-in modules](https://nodejs.org/api/) are available in
|
||||
NodeGui. Also, third-party node modules that are known to work with Node.Js are fully supported as well (including
|
||||
the native node modules).
|
||||
|
||||
Apart from Node.Js ecosystem, NodeGui also provides some extra built-in widget and modules for developing native
|
||||
desktop applications. So, you can think of NodeGui as NodeJs + Gui Widgets powered by Qt.
|
||||
|
||||
The app script is like a normal Node.js script:
|
||||
|
||||
```javascript
|
||||
const { QMainWindow } = require("@nodegui/nodegui");
|
||||
|
||||
const win = new QMainWindow();
|
||||
|
||||
win.show();
|
||||
|
||||
global.win = win; // To prevent win from being garbage collected.
|
||||
```
|
||||
|
||||
To run your app, read [Run your app](/docs/guides/tutorial).
|
||||
|
||||
## Destructuring assignment
|
||||
|
||||
You can use
|
||||
[destructuring assignment][destructuring-assignment] to make it easier to use
|
||||
built-in modules.
|
||||
|
||||
```javascript
|
||||
const {
|
||||
QMainWindow,
|
||||
QWidget,
|
||||
QLabel,
|
||||
FlexLayout
|
||||
} = require("@nodegui/nodegui");
|
||||
|
||||
const win = new QMainWindow();
|
||||
|
||||
const centralWidget = new QWidget();
|
||||
centralWidget.setObjectName("myroot");
|
||||
const rootLayout = new FlexLayout();
|
||||
centralWidget.setLayout(rootLayout);
|
||||
|
||||
const label = new QLabel();
|
||||
label.setInlineStyle("font-size: 16px; font-weight: bold;");
|
||||
label.setText("Hello World");
|
||||
|
||||
rootLayout.addWidget(label);
|
||||
win.setCentralWidget(centralWidget);
|
||||
win.setStyleSheet(
|
||||
`
|
||||
#myroot {
|
||||
background-color: #009688;
|
||||
}
|
||||
`
|
||||
);
|
||||
win.show();
|
||||
|
||||
global.win = win;
|
||||
```
|
||||
|
||||
[gui]: https://en.wikipedia.org/wiki/Graphical_user_interface
|
||||
[destructuring-assignment]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
|
||||
Reference in New Issue
Block a user