nodeguy/website/docs/api/QLabel.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

62 lines
1.5 KiB
Markdown

---
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