Merge pull request #55 from Uriziel01/feature/SetWindowTitle
Added setWindowTitle widget method with docs
This commit is contained in:
commit
6d3e436070
@ -82,6 +82,12 @@ Sets the property that holds the widget's style sheet. It calls the native metho
|
||||
|
||||
- `styleSheet` string - String which holds the widget's style sheet. Make sure you create this string using `StyleSheet.create()`
|
||||
|
||||
#### `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).
|
||||
|
||||
@ -57,6 +57,14 @@ Napi::Value setStyleSheet(const Napi::CallbackInfo& info){ \
|
||||
this->instance->setStyleSheet(style.c_str()); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value setWindowTitle(const Napi::CallbackInfo& info){ \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
Napi::String napiTitle = info[0].As<Napi::String>(); \
|
||||
std::string title = napiTitle.Utf8Value(); \
|
||||
this->instance->setWindowTitle(title.c_str()); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value styleSheet(const Napi::CallbackInfo& info){ \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
@ -219,6 +227,7 @@ Napi::Value setWindowFlag(const Napi::CallbackInfo& info){ \
|
||||
InstanceMethod("close",&WidgetWrapName::close), \
|
||||
InstanceMethod("setLayout",&WidgetWrapName::setLayout), \
|
||||
InstanceMethod("setStyleSheet",&WidgetWrapName::setStyleSheet), \
|
||||
InstanceMethod("setWindowTitle",&WidgetWrapName::setWindowTitle), \
|
||||
InstanceMethod("styleSheet",&WidgetWrapName::styleSheet), \
|
||||
InstanceMethod("hide",&WidgetWrapName::hide), \
|
||||
InstanceMethod("move",&WidgetWrapName::move), \
|
||||
|
||||
@ -36,6 +36,9 @@ export abstract class NodeWidget extends EventWidget {
|
||||
const preparedSheet = await StyleSheet.create(styleSheet);
|
||||
await applyStyleSheet(this, preparedSheet);
|
||||
};
|
||||
setWindowTitle = async (title: string) => {
|
||||
return this.native.setWindowTitle(title);
|
||||
};
|
||||
setInlineStyle = async (style: string) => {
|
||||
const preparedSheet = await prepareInlineStyleSheet(this, style);
|
||||
await applyStyleSheet(this, preparedSheet);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user