Combine NodeObject+QObject; put native field in Component
This commit is contained in:
parent
4f40510248
commit
c6d30f8f9f
10
src/index.ts
10
src/index.ts
@ -153,7 +153,7 @@ export { QDateTime } from './lib/QtCore/QDateTime';
|
||||
export { QItemSelectionModel, SelectionFlag } from './lib/QtCore/QItemSelectionModel';
|
||||
export { QModelIndex } from './lib/QtCore/QModelIndex';
|
||||
export { QMimeData } from './lib/QtCore/QMimeData';
|
||||
export { QObject, QObjectSignals, NodeObject } from './lib/QtCore/QObject';
|
||||
export { QObject, QObjectSignals } from './lib/QtCore/QObject';
|
||||
export { QVariant } from './lib/QtCore/QVariant';
|
||||
export { QSize } from './lib/QtCore/QSize';
|
||||
export { QSizeF } from './lib/QtCore/QSizeF';
|
||||
@ -163,7 +163,13 @@ export { QPoint } from './lib/QtCore/QPoint';
|
||||
export { QPointF } from './lib/QtCore/QPointF';
|
||||
export { QColor } from './lib/QtGui/QColor';
|
||||
export { QTime } from './lib/QtCore/QTime';
|
||||
export { QUrl, ParsingMode } from './lib/QtCore/QUrl';
|
||||
export {
|
||||
QUrl,
|
||||
ParsingMode,
|
||||
UserInputResolutionOption,
|
||||
UrlFormattingOption,
|
||||
ComponentFormattingOption,
|
||||
} from './lib/QtCore/QUrl';
|
||||
export { QSettings, QSettingsFormat, QSettingsScope } from './lib/QtCore/QSettings';
|
||||
// Layouts:
|
||||
export { QBoxLayout, QBoxLayoutSignals } from './lib/QtWidgets/QBoxLayout';
|
||||
|
||||
@ -1,18 +1,14 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QModelIndex } from './QModelIndex';
|
||||
import { QVariant } from './QVariant';
|
||||
import { ItemDataRole, ItemFlag, Orientation } from '../QtEnums';
|
||||
|
||||
export type QAbstractItemSignals = QObjectSignals;
|
||||
|
||||
export class QAbstractItemModel extends NodeObject<any> {
|
||||
native: NativeElement;
|
||||
export class QAbstractItemModel extends QObject<any> {
|
||||
constructor() {
|
||||
const native = new addon.QAbstractItemModel();
|
||||
super(native);
|
||||
this.native = native;
|
||||
super(new addon.QAbstractItemModel());
|
||||
const dispatcher = (methodName: string, ...args: any[]): any => {
|
||||
switch (methodName) {
|
||||
case 'index':
|
||||
|
||||
@ -5,17 +5,17 @@ import { QVariant } from './QVariant';
|
||||
import { DateFormat } from '../QtEnums';
|
||||
|
||||
export class QDate extends Component {
|
||||
native: NativeElement;
|
||||
constructor(arg?: NativeElement | number, month?: number, day?: number) {
|
||||
super();
|
||||
const count = arguments.length;
|
||||
let native: NativeElement;
|
||||
if (count == 3) {
|
||||
this.native = new addon.QDate(arg, month, day);
|
||||
} else if (count == 1 && checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = new addon.QDate(arg, month, day);
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
native = arg as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QDate();
|
||||
native = new addon.QDate();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
addDays(ndays: number): QDate {
|
||||
return new QDate(this.native.addDays(ndays));
|
||||
|
||||
@ -7,17 +7,17 @@ import { QTime } from './QTime';
|
||||
import { TimeSpec, DateFormat } from '../QtEnums';
|
||||
|
||||
export class QDateTime extends Component {
|
||||
native: NativeElement;
|
||||
constructor(arg?: NativeElement, time?: NativeElement) {
|
||||
super();
|
||||
const count = arguments.length;
|
||||
let native: NativeElement;
|
||||
if (arg && time) {
|
||||
this.native = new addon.QDateTime(arg.native, time.native);
|
||||
native = new addon.QDateTime(arg.native, time.native);
|
||||
} else if (count == 1 && checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QDateTime();
|
||||
native = new addon.QDateTime();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
addDays(ndays: number): QDateTime {
|
||||
return new QDateTime(this.native.addDays(ndays));
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QModelIndex } from './QModelIndex';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
|
||||
export type QItemSelectionModelSignals = QObjectSignals;
|
||||
|
||||
export class QItemSelectionModel extends NodeObject<QItemSelectionModelSignals> {
|
||||
native: NativeElement;
|
||||
export class QItemSelectionModel extends QObject<QItemSelectionModelSignals> {
|
||||
constructor(arg?: NativeElement) {
|
||||
let native = null;
|
||||
if (arg == null) {
|
||||
@ -18,7 +17,6 @@ export class QItemSelectionModel extends NodeObject<QItemSelectionModelSignals>
|
||||
throw new Error('QItemSelectionModel cannot be initialised this way.');
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
}
|
||||
|
||||
// *** Public Functions ***
|
||||
|
||||
@ -6,14 +6,14 @@ import { QUrl } from './QUrl';
|
||||
* description
|
||||
*/
|
||||
export class QMimeData extends Component {
|
||||
native: NativeElement;
|
||||
constructor(arg?: NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QMimeData();
|
||||
native = new addon.QMimeData();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -6,18 +6,16 @@ import { ItemDataRole } from '../QtEnums/ItemDataRole';
|
||||
import { ItemFlag } from '../QtEnums/ItemFlag';
|
||||
|
||||
export class QModelIndex extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(arg?: NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (!arg) {
|
||||
this.native = new addon.QModelIndex();
|
||||
native = new addon.QModelIndex();
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else {
|
||||
throw new Error('QModelIndex cannot be initialised this way.');
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
column(): number {
|
||||
return this.native.column();
|
||||
|
||||
@ -5,7 +5,22 @@ import addon from '../utils/addon';
|
||||
import { QVariant, QVariantType } from './QVariant';
|
||||
import { TimerType } from '../QtEnums/TimerType';
|
||||
|
||||
export abstract class NodeObject<Signals extends QObjectSignals> extends EventWidget<Signals> {
|
||||
export class QObject<Signals extends QObjectSignals = QObjectSignals> extends EventWidget<Signals> {
|
||||
constructor(nativeElementOrParent?: NativeElement | QObject) {
|
||||
let native;
|
||||
let parent;
|
||||
if (checkIfNativeElement(nativeElementOrParent)) {
|
||||
native = nativeElementOrParent as NativeElement;
|
||||
} else if (nativeElementOrParent) {
|
||||
parent = nativeElementOrParent as QObject<any>;
|
||||
native = new addon.QObject(parent.native);
|
||||
} else {
|
||||
native = new addon.QObject();
|
||||
}
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
|
||||
inherits(className: string): boolean {
|
||||
return this.native.inherits(className);
|
||||
}
|
||||
@ -28,7 +43,7 @@ export abstract class NodeObject<Signals extends QObjectSignals> extends EventWi
|
||||
dumpObjectInfo(): void {
|
||||
this.native.dumpObjectInfo();
|
||||
}
|
||||
setParent(parent: NodeObject<QObjectSignals>): void {
|
||||
setParent(parent: QObject): void {
|
||||
if (parent != null) {
|
||||
const extern = parent.native.__external_qobject__();
|
||||
this.native.setParent(extern);
|
||||
@ -47,25 +62,3 @@ export abstract class NodeObject<Signals extends QObjectSignals> extends EventWi
|
||||
export interface QObjectSignals {
|
||||
objectNameChanged: (objectName: string) => void;
|
||||
}
|
||||
|
||||
export class QObject extends NodeObject<QObjectSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(parent: NodeObject<any>);
|
||||
constructor(arg?: NodeObject<any> | NativeElement) {
|
||||
let native;
|
||||
let parent;
|
||||
if (checkIfNativeElement(arg)) {
|
||||
native = arg as NativeElement;
|
||||
} else if (arg) {
|
||||
parent = arg as NodeObject<any>;
|
||||
native = new addon.QObject(parent.native);
|
||||
} else {
|
||||
native = new addon.QObject();
|
||||
}
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
this.native = native;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,19 +7,19 @@ import { QVariant } from './QVariant';
|
||||
* The QPoint class defines a point in the plane using integer precision.
|
||||
*/
|
||||
export class QPoint extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(x?: number, y?: number);
|
||||
constructor(arg?: NativeElement | number, y = 0) {
|
||||
super();
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
} else if (typeof arg === 'number') {
|
||||
this.native = new addon.QPoint(arg, y);
|
||||
constructor(nativeOrX?: NativeElement | number, y = 0) {
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(nativeOrX)) {
|
||||
native = nativeOrX as NativeElement;
|
||||
} else if (typeof nativeOrX === 'number') {
|
||||
native = new addon.QPoint(nativeOrX, y);
|
||||
} else {
|
||||
this.native = new addon.QPoint();
|
||||
native = new addon.QPoint();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
setX(value: number): void {
|
||||
this.native.setX(value);
|
||||
|
||||
@ -11,22 +11,18 @@ import { QPoint } from './QPoint';
|
||||
* In addition, the QPointF class provides a constructor converting a QPoint object into a QPointF object, and a corresponding toPoint() function which returns a QPoint copy of this point.
|
||||
*/
|
||||
export class QPointF extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(x?: number, y?: number);
|
||||
constructor(point: QPoint);
|
||||
constructor(arg?: NativeElement | number | QPoint, y = 0) {
|
||||
super();
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
} else if (typeof arg === 'number') {
|
||||
this.native = new addon.QPointF(arg, y);
|
||||
} else if (arg instanceof QPoint) {
|
||||
this.native = new addon.QPointF(arg.x(), arg.y());
|
||||
constructor(nativeOrXOrQPoint?: NativeElement | number | QPoint, y = 0) {
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(nativeOrXOrQPoint)) {
|
||||
native = nativeOrXOrQPoint as NativeElement;
|
||||
} else if (typeof nativeOrXOrQPoint === 'number') {
|
||||
native = new addon.QPointF(nativeOrXOrQPoint, y);
|
||||
} else if (nativeOrXOrQPoint instanceof QPoint) {
|
||||
native = new addon.QPointF(nativeOrXOrQPoint.x(), nativeOrXOrQPoint.y());
|
||||
} else {
|
||||
this.native = new addon.QPointF();
|
||||
native = new addon.QPointF();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
/**
|
||||
* Sets the x coordinate of this point to the given x coordinate.
|
||||
|
||||
@ -4,20 +4,17 @@ import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { QVariant } from './QVariant';
|
||||
|
||||
export class QRect extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(x?: number, y?: number, width?: number, height?: number);
|
||||
constructor(arg?: NativeElement | number, y = 0, width = 0, height = 0) {
|
||||
super();
|
||||
constructor(nativeOrX?: NativeElement | number, y = 0, width = 0, height = 0) {
|
||||
const count = arguments.length;
|
||||
let native: NativeElement;
|
||||
if (count > 1) {
|
||||
this.native = new addon.QRect(arg, y, width, height);
|
||||
} else if (count == 1 && checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = new addon.QRect(nativeOrX, y, width, height);
|
||||
} else if (checkIfNativeElement(nativeOrX)) {
|
||||
native = nativeOrX as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QRect();
|
||||
native = new addon.QRect();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
setWidth(width: number): void {
|
||||
return this.native.setWidth(width);
|
||||
|
||||
@ -8,20 +8,17 @@ import { QRect } from './QRect';
|
||||
* description
|
||||
*/
|
||||
export class QRectF extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(x?: number, y?: number, width?: number, height?: number);
|
||||
constructor(arg?: NativeElement | number, y = 0, width = 0, height = 0) {
|
||||
super();
|
||||
constructor(nativeOrX?: NativeElement | number, y = 0, width = 0, height = 0) {
|
||||
const count = arguments.length;
|
||||
let native: NativeElement;
|
||||
if (count > 1) {
|
||||
this.native = new addon.QRectF(arg, y, width, height);
|
||||
} else if (count == 1 && checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = new addon.QRectF(nativeOrX, y, width, height);
|
||||
} else if (count == 1 && checkIfNativeElement(nativeOrX)) {
|
||||
native = nativeOrX as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QRectF();
|
||||
native = new addon.QRectF();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { NativeElement, Component } from '../core/Component';
|
||||
import { Component } from '../core/Component';
|
||||
import addon from '../utils/addon';
|
||||
import { QVariant } from './QVariant';
|
||||
|
||||
@ -16,10 +16,8 @@ export enum QSettingsScope {
|
||||
}
|
||||
|
||||
export class QSettings extends Component {
|
||||
native: NativeElement;
|
||||
constructor(organization: string, application: string) {
|
||||
super();
|
||||
this.native = new addon.QSettings(organization, application);
|
||||
super(new addon.QSettings(organization, application));
|
||||
}
|
||||
sync(): void {
|
||||
this.native.sync();
|
||||
|
||||
@ -4,19 +4,18 @@ import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { QVariant } from './QVariant';
|
||||
|
||||
export class QSize extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(width?: number, height?: number);
|
||||
constructor(arg?: number | NativeElement, height?: number) {
|
||||
super();
|
||||
if (!arg) {
|
||||
this.native = new addon.QSize();
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
constructor(nativeOrWidth?: number | NativeElement, height?: number) {
|
||||
let native: NativeElement;
|
||||
if (!nativeOrWidth) {
|
||||
native = new addon.QSize();
|
||||
} else if (checkIfNativeElement(nativeOrWidth)) {
|
||||
native = nativeOrWidth as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QSize(arg, height);
|
||||
native = new addon.QSize(nativeOrWidth, height);
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
setWidth(width: number): void {
|
||||
return this.native.setWidth(width);
|
||||
|
||||
@ -4,19 +4,16 @@ import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { QVariant } from './QVariant';
|
||||
|
||||
export class QSizeF extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(width?: number, height?: number);
|
||||
constructor(arg?: number | NativeElement, height?: number) {
|
||||
super();
|
||||
if (!arg) {
|
||||
this.native = new addon.QSizeF();
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
constructor(nativeOrWidth?: number | NativeElement, height?: number) {
|
||||
let native: NativeElement;
|
||||
if (!nativeOrWidth) {
|
||||
native = new addon.QSizeF();
|
||||
} else if (checkIfNativeElement(nativeOrWidth)) {
|
||||
native = nativeOrWidth as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QSizeF(arg, height);
|
||||
native = new addon.QSizeF(nativeOrWidth, height);
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
setWidth(width: number): void {
|
||||
return this.native.setWidth(width);
|
||||
|
||||
@ -5,17 +5,17 @@ import { QVariant } from './QVariant';
|
||||
import { DateFormat } from '../QtEnums';
|
||||
|
||||
export class QTime extends Component {
|
||||
native: NativeElement;
|
||||
constructor(arg?: NativeElement | number, m?: number, s = 0, ms = 0) {
|
||||
super();
|
||||
constructor(nativeOrHours?: NativeElement | number, m?: number, s = 0, ms = 0) {
|
||||
const count = arguments.length;
|
||||
let native: NativeElement;
|
||||
if (count > 1) {
|
||||
this.native = new addon.QTime(arg, m, s, ms);
|
||||
} else if (count == 1 && checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = new addon.QTime(nativeOrHours, m, s, ms);
|
||||
} else if (checkIfNativeElement(nativeOrHours)) {
|
||||
native = nativeOrHours as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QTime();
|
||||
native = new addon.QTime();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
addMSecs(ms: number): QTime {
|
||||
return new QTime(this.native.addMSecs(ms));
|
||||
|
||||
@ -3,7 +3,7 @@ import addon from '../utils/addon';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { QVariant } from './QVariant';
|
||||
|
||||
enum ComponentFormattingOption {
|
||||
export enum ComponentFormattingOption {
|
||||
/** The component is returned in a "pretty form", with most percent-encoded characters decoded. The exact behavior of PrettyDecoded varies from component to component and may also change from Qt release to Qt release. This is the default. */
|
||||
PrettyDecoded = 0x000000,
|
||||
/** Leave space characters in their encoded form ("%20"). */
|
||||
@ -29,7 +29,7 @@ export enum ParsingMode {
|
||||
/** QUrl will interpret the URL component in the fully-decoded form, where percent characters stand for themselves, not as the beginning of a percent-encoded sequence. This mode is only valid for the setters setting components of a URL; it is not permitted in the QUrl constructor, in fromEncoded() or in setUrl(). For more information on this mode, see the documentation for QUrl::FullyDecoded.*/
|
||||
DecodedMode = 2,
|
||||
}
|
||||
enum UrlFormattingOption {
|
||||
export enum UrlFormattingOption {
|
||||
None = 0x0,
|
||||
RemoveScheme = 0x1,
|
||||
RemovePassword = 0x2,
|
||||
@ -44,7 +44,7 @@ enum UrlFormattingOption {
|
||||
StripTrailingSlash = 0x400,
|
||||
NormalizePathSegments = 0x1000,
|
||||
}
|
||||
enum UserInputResolutionOption {
|
||||
export enum UserInputResolutionOption {
|
||||
/** The default resolution mechanism is to check whether a local file exists, in the working directory given to fromUserInput, and only return a local path in that case. Otherwise a URL is assumed. */
|
||||
DefaultResolution = 0,
|
||||
/** This option makes fromUserInput() always return a local path unless the input contains a scheme, such as http://file.pl. This is useful for applications such as text editors, which are able to create the file if it doesn't exist. */
|
||||
@ -52,27 +52,19 @@ enum UserInputResolutionOption {
|
||||
}
|
||||
|
||||
export class QUrl extends Component {
|
||||
static readonly ComponentFormattingOption = ComponentFormattingOption;
|
||||
static readonly ParsingMode = ParsingMode;
|
||||
static readonly UrlFormattingOption = UrlFormattingOption;
|
||||
static readonly UserInputResolutionOption = UserInputResolutionOption;
|
||||
readonly ComponentFormattingOption = ComponentFormattingOption;
|
||||
readonly ParsingMode = ParsingMode;
|
||||
readonly UrlFormattingOption = UrlFormattingOption;
|
||||
readonly UserInputResolutionOption = UserInputResolutionOption;
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(url: string, parsingMode?: ParsingMode);
|
||||
constructor(arg?: string | NativeElement, parsingMode: ParsingMode = ParsingMode.TolerantMode) {
|
||||
super();
|
||||
if (!arg) {
|
||||
this.native = new addon.QUrl();
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
constructor(nativeOrString?: string | NativeElement, parsingMode: ParsingMode = ParsingMode.TolerantMode) {
|
||||
let native: NativeElement;
|
||||
if (!nativeOrString) {
|
||||
native = new addon.QUrl();
|
||||
} else if (checkIfNativeElement(nativeOrString)) {
|
||||
native = nativeOrString as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QUrl(arg, parsingMode);
|
||||
native = new addon.QUrl(nativeOrString, parsingMode);
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
|
||||
static fromQVariant(variant: QVariant): QUrl {
|
||||
|
||||
@ -5,19 +5,19 @@ import { checkIfNativeElement } from '../utils/helpers';
|
||||
export type QVariantType = NativeElement | string | string[] | number | boolean;
|
||||
|
||||
export class QVariant extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(variant: QVariantType);
|
||||
constructor(arg?: QVariantType | NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(arg) && arg instanceof addon.QVariant) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else if (arg) {
|
||||
this.native = new addon.QVariant.convertToQVariant(arg);
|
||||
native = new addon.QVariant.convertToQVariant(arg);
|
||||
} else {
|
||||
this.native = new addon.QVariant();
|
||||
native = new addon.QVariant();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
toString(): string {
|
||||
return this.native.toString();
|
||||
|
||||
@ -3,7 +3,7 @@ import { NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { QClipboard } from './QClipboard';
|
||||
import { QStyle } from './QStyle';
|
||||
import { QObjectSignals, NodeObject } from '../QtCore/QObject';
|
||||
import { QObjectSignals, QObject } from '../QtCore/QObject';
|
||||
import { QPalette } from './QPalette';
|
||||
import { StyleSheet } from '../core/Style/StyleSheet';
|
||||
import memoizeOne from 'memoize-one';
|
||||
@ -27,8 +27,7 @@ const qApp = QApplication.instance();
|
||||
qApp.quit();
|
||||
```
|
||||
*/
|
||||
export class QApplication extends NodeObject<QApplicationSignals> {
|
||||
native: NativeElement;
|
||||
export class QApplication extends QObject<QApplicationSignals> {
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(arg?: NativeElement) {
|
||||
@ -39,7 +38,6 @@ export class QApplication extends NodeObject<QApplicationSignals> {
|
||||
native = new addon.QApplication();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
|
||||
this.setStyleSheet = memoizeOne(this.setStyleSheet);
|
||||
}
|
||||
|
||||
@ -21,18 +21,18 @@ const brush = new QBrush();
|
||||
```
|
||||
*/
|
||||
export class QBrush extends Component {
|
||||
native: NativeElement;
|
||||
constructor(arg?: NativeElement | GlobalColor | QColor, style = BrushStyle.SolidPattern) {
|
||||
super();
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
} else if (typeof arg === 'number') {
|
||||
this.native = new addon.QBrush(arg, style);
|
||||
} else if (arg == null) {
|
||||
this.native = new addon.QBrush();
|
||||
constructor(nativeOrGlobalColor?: NativeElement | GlobalColor | QColor, style = BrushStyle.SolidPattern) {
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(nativeOrGlobalColor)) {
|
||||
native = nativeOrGlobalColor as NativeElement;
|
||||
} else if (typeof nativeOrGlobalColor === 'number') {
|
||||
native = new addon.QBrush(nativeOrGlobalColor, style);
|
||||
} else if (nativeOrGlobalColor == null) {
|
||||
native = new addon.QBrush();
|
||||
} else {
|
||||
this.native = new addon.QBrush(arg?.native, style);
|
||||
native = new addon.QBrush(nativeOrGlobalColor?.native, style);
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
isOpaque(): boolean {
|
||||
return this.native.isOpaque();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement, registerNativeWrapFunction } from '../utils/helpers';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QPixmap } from './QPixmap';
|
||||
import { wrapperCache } from '../core/WrapperCache';
|
||||
|
||||
@ -23,15 +23,12 @@ const clipboard = QApplication.clipboard();
|
||||
const text = clipboard.text(QClipboardMode.Clipboard);
|
||||
```
|
||||
*/
|
||||
export class QClipboard extends NodeObject<QClipboardSignals> {
|
||||
native: NativeElement;
|
||||
export class QClipboard extends QObject<QClipboardSignals> {
|
||||
constructor(native: NativeElement) {
|
||||
super(native);
|
||||
if (checkIfNativeElement(native)) {
|
||||
this.native = native;
|
||||
} else {
|
||||
if (!checkIfNativeElement(native)) {
|
||||
throw new Error('QClipboard cannot be initialised this way. Use QApplication::clipboard()');
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
clear(mode = QClipboardMode.Clipboard): void {
|
||||
this.native.clear(mode);
|
||||
|
||||
@ -5,28 +5,28 @@ import { QVariant } from '../QtCore/QVariant';
|
||||
import { GlobalColor } from '../QtEnums';
|
||||
|
||||
export class QColor extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(nativeElement: NativeElement);
|
||||
constructor(colorString: string);
|
||||
constructor(color: GlobalColor);
|
||||
constructor(r?: number, g?: number, b?: number, a?: number);
|
||||
constructor(arg?: NativeElement | number | string, g = 0, b = 0, a = 255) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else if (typeof arg === 'number') {
|
||||
if (arguments.length === 1) {
|
||||
// This is for QGlobalColor enum
|
||||
this.native = new addon.QColor(arg);
|
||||
native = new addon.QColor(arg);
|
||||
} else {
|
||||
this.native = new addon.QColor(arg, g, b, a);
|
||||
native = new addon.QColor(arg, g, b, a);
|
||||
}
|
||||
} else if (typeof arg === 'string') {
|
||||
this.native = new addon.QColor(arg);
|
||||
native = new addon.QColor(arg);
|
||||
} else {
|
||||
this.native = new addon.QColor();
|
||||
native = new addon.QColor();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
setRed(value: number): void {
|
||||
this.native.setRed(value);
|
||||
|
||||
@ -17,17 +17,17 @@ const cursor = new QCursor();
|
||||
```
|
||||
*/
|
||||
export class QCursor extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(shape: CursorShape);
|
||||
constructor(arg?: NativeElement | CursorShape) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (arg) {
|
||||
this.native = new addon.QCursor(arg);
|
||||
native = new addon.QCursor(arg);
|
||||
} else {
|
||||
this.native = new addon.QCursor();
|
||||
native = new addon.QCursor();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
pos(): { x: number; y: number } {
|
||||
return this.native.pos();
|
||||
|
||||
@ -11,21 +11,18 @@ import { QMimeData } from '../QtCore/QMimeData';
|
||||
* description
|
||||
*/
|
||||
export class QDrag extends Component {
|
||||
native: NativeElement;
|
||||
constructor(arg?: NativeElement | QObject) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (!arg) {
|
||||
this.native = new addon.QDrag();
|
||||
native = new addon.QDrag();
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
native = arg as NativeElement;
|
||||
} else if (arg.native) {
|
||||
native = new addon.QDrag(arg.native);
|
||||
} else {
|
||||
const isNative = checkIfNativeElement(arg);
|
||||
if (isNative) {
|
||||
this.native = arg as NativeElement;
|
||||
} else if (arg.native) {
|
||||
this.native = new addon.QDrag(arg.native);
|
||||
} else {
|
||||
this.native = new addon.QDrag();
|
||||
}
|
||||
native = new addon.QDrag();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,22 +4,22 @@ import { QVariant } from '../QtCore/QVariant';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
|
||||
export class QFont extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(font: QFont);
|
||||
constructor(native: NativeElement);
|
||||
constructor(family: string, pointSize?: number, weight?: QFontWeight, italic?: boolean);
|
||||
constructor(arg?: QFont | string | NativeElement, pointSize = -1, weight = -1, italic = false) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else if (arg instanceof QFont) {
|
||||
this.native = arg.native;
|
||||
native = arg.native;
|
||||
} else if (typeof arg === 'string') {
|
||||
this.native = new addon.QFont(arg, pointSize, weight, italic);
|
||||
native = new addon.QFont(arg, pointSize, weight, italic);
|
||||
} else {
|
||||
this.native = new addon.QFont();
|
||||
native = new addon.QFont();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
bold(): boolean {
|
||||
return this.native.bold();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import addon from '../utils/addon';
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { Component } from '../core/Component';
|
||||
|
||||
export enum WritingSystem {
|
||||
Any = 0,
|
||||
@ -40,10 +40,8 @@ export enum WritingSystem {
|
||||
}
|
||||
|
||||
export class QFontDatabase extends Component {
|
||||
native: NativeElement;
|
||||
constructor() {
|
||||
super();
|
||||
this.native = new addon.QFontDatabase();
|
||||
super(new addon.QFontDatabase());
|
||||
}
|
||||
families(ws: WritingSystem = WritingSystem.Any): string[] {
|
||||
return this.native.families(ws);
|
||||
|
||||
@ -7,19 +7,19 @@ import { TextElideMode, TextFlag } from '../QtEnums';
|
||||
import { QRect } from '../..';
|
||||
|
||||
export class QFontMetrics extends Component {
|
||||
native: NativeElement;
|
||||
constructor(native: NativeElement);
|
||||
constructor(qfont: QFont);
|
||||
constructor(qfontmetrics: QFontMetrics);
|
||||
constructor(arg: QFont | QFontMetrics | NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else if (arg instanceof QFontMetrics) {
|
||||
this.native = arg.native;
|
||||
native = arg.native;
|
||||
} else {
|
||||
this.native = new addon.QFontMetrics(arg.native);
|
||||
native = new addon.QFontMetrics(arg.native);
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
// *** Public Functions ***
|
||||
|
||||
|
||||
@ -7,19 +7,19 @@ import { TextElideMode, TextFlag } from '../QtEnums';
|
||||
import { QRect } from '../..';
|
||||
|
||||
export class QFontMetricsF extends Component {
|
||||
native: NativeElement;
|
||||
constructor(native: NativeElement);
|
||||
constructor(qfont: QFont);
|
||||
constructor(qfontmetricsf: QFontMetricsF);
|
||||
constructor(arg: QFont | QFontMetricsF | NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else if (arg instanceof QFontMetricsF) {
|
||||
this.native = arg.native;
|
||||
native = arg.native;
|
||||
} else {
|
||||
this.native = new addon.QFontMetricsF(arg.native);
|
||||
native = new addon.QFontMetricsF(arg.native);
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
// *** Public Functions ***
|
||||
|
||||
|
||||
@ -20,20 +20,20 @@ const icon = new QIcon(imageUrl);
|
||||
```
|
||||
*/
|
||||
export class QIcon extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(filePath: string);
|
||||
constructor(arg?: string | NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (typeof arg === 'string') {
|
||||
const imagePath = arg;
|
||||
this.native = new addon.QIcon(imagePath);
|
||||
native = new addon.QIcon(imagePath);
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QIcon();
|
||||
native = new addon.QIcon();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
pixmap(width: number, height: number, mode?: QIconMode, state?: QIconState): QPixmap {
|
||||
let nativePixmap;
|
||||
|
||||
@ -24,19 +24,13 @@ const image = new QImage();
|
||||
```
|
||||
*/
|
||||
export class QImage extends Component {
|
||||
native!: NativeElement;
|
||||
|
||||
/** Constructs a null image */
|
||||
constructor();
|
||||
|
||||
constructor(native: NativeElement);
|
||||
|
||||
/** Constructs an image and tries to load the image from the file with the given fileName */
|
||||
constructor(filename: string);
|
||||
|
||||
/** Constructs an image with the given width, height and format */
|
||||
constructor(width: number, height: number, format: QImageFormat);
|
||||
|
||||
/** Constructs an image with the given size and format */
|
||||
constructor(size: QSize, format: QImageFormat);
|
||||
constructor(
|
||||
@ -44,19 +38,19 @@ export class QImage extends Component {
|
||||
formatOrHeight?: QImageFormat | string | number,
|
||||
format?: QImageFormat,
|
||||
) {
|
||||
super();
|
||||
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else if (typeof arg === 'string') {
|
||||
this.native = new addon.QImage(arg);
|
||||
native = new addon.QImage(arg);
|
||||
} else if (typeof arg === 'number') {
|
||||
this.native = new addon.QImage(arg, formatOrHeight, format);
|
||||
native = new addon.QImage(arg, formatOrHeight, format);
|
||||
} else if (arg instanceof QSize) {
|
||||
this.native = new addon.QImage(arg.native, formatOrHeight);
|
||||
native = new addon.QImage(arg.native, formatOrHeight);
|
||||
} else {
|
||||
this.native = new addon.QImage();
|
||||
native = new addon.QImage();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -18,20 +18,20 @@ const keySequence = new QKeySequence(`Ctrl+L`);
|
||||
```
|
||||
*/
|
||||
export class QKeySequence extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(keySequence: string);
|
||||
constructor(arg?: string | NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (typeof arg === 'string') {
|
||||
const keySequence = arg;
|
||||
this.native = new addon.QKeySequence(keySequence);
|
||||
native = new addon.QKeySequence(keySequence);
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QKeySequence();
|
||||
native = new addon.QKeySequence();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
count(): number {
|
||||
return this.native.count();
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QSize } from '../QtCore/QSize';
|
||||
import { QPixmap } from './QPixmap';
|
||||
|
||||
export class QMovie extends NodeObject<QMovieSignals> {
|
||||
native: NativeElement;
|
||||
export class QMovie extends QObject<QMovieSignals> {
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(parent: NodeObject<any>);
|
||||
constructor(arg?: NodeObject<any> | NativeElement) {
|
||||
constructor(parent: QObject);
|
||||
constructor(arg?: QObject | NativeElement) {
|
||||
let native: NativeElement;
|
||||
if (arg) {
|
||||
if (checkIfNativeElement(arg)) {
|
||||
@ -22,7 +21,6 @@ export class QMovie extends NodeObject<QMovieSignals> {
|
||||
native = new addon.QMovie();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
}
|
||||
//Methods
|
||||
setFileName(fileName: string): void {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { Component } from '../core/Component';
|
||||
import { QColor } from './QColor';
|
||||
|
||||
export enum ColorGroup {
|
||||
@ -33,12 +33,6 @@ export enum ColorRole {
|
||||
}
|
||||
|
||||
export class QPalette extends Component {
|
||||
native: NativeElement;
|
||||
constructor(native: NativeElement) {
|
||||
super();
|
||||
this.native = native;
|
||||
}
|
||||
|
||||
color(group: ColorGroup, role: ColorRole): QColor {
|
||||
return new QColor(this.native.color(group, role));
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { Component } from '../core/Component';
|
||||
import addon from '../utils/addon';
|
||||
import { GlobalColor, PenStyle, PenCapStyle } from '../QtEnums';
|
||||
import { QColor } from './QColor';
|
||||
@ -18,10 +18,8 @@ const pen = new QPen();
|
||||
```
|
||||
*/
|
||||
export class QPen extends Component {
|
||||
native: NativeElement;
|
||||
constructor() {
|
||||
super();
|
||||
this.native = new addon.QPen();
|
||||
super(new addon.QPen());
|
||||
}
|
||||
setColor(color: QColor | GlobalColor): void {
|
||||
if (typeof color === 'number') {
|
||||
|
||||
@ -18,20 +18,20 @@ const picture = new QPicture();
|
||||
```
|
||||
*/
|
||||
export class QPicture extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(formatVersion: number);
|
||||
constructor(arg?: number | NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (typeof arg === 'number') {
|
||||
const formatVersion = arg;
|
||||
this.native = new addon.QPicture(formatVersion);
|
||||
native = new addon.QPicture(formatVersion);
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QPicture();
|
||||
native = new addon.QPicture();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
setBoundingRect(r: QRect): void {
|
||||
this.native.setBoundingRect(r.native);
|
||||
|
||||
@ -23,20 +23,20 @@ const pixMap = new QPixmap(imageUrl);
|
||||
```
|
||||
*/
|
||||
export class QPixmap extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(filePath: string);
|
||||
constructor(arg?: string | NativeElement) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (typeof arg === 'string') {
|
||||
const imagePath = arg;
|
||||
this.native = new addon.QPixmap(imagePath);
|
||||
native = new addon.QPixmap(imagePath);
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
this.native = arg as NativeElement;
|
||||
native = arg as NativeElement;
|
||||
} else {
|
||||
this.native = new addon.QPixmap();
|
||||
native = new addon.QPixmap();
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
load(imagePath: string): boolean {
|
||||
return this.native.load(imagePath);
|
||||
|
||||
@ -1,21 +1,18 @@
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement, registerNativeWrapFunction } from '../utils/helpers';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QRect } from '../QtCore/QRect';
|
||||
import { QSizeF } from '../QtCore/QSizeF';
|
||||
import { QSize } from '../QtCore/QSize';
|
||||
import { wrapperCache } from '../core/WrapperCache';
|
||||
import { QPixmap } from './QPixmap';
|
||||
|
||||
export class QScreen extends NodeObject<QScreenSignals> {
|
||||
native: NativeElement;
|
||||
export class QScreen extends QObject<QScreenSignals> {
|
||||
constructor(native: NativeElement) {
|
||||
super(native);
|
||||
if (checkIfNativeElement(native)) {
|
||||
this.native = native;
|
||||
} else {
|
||||
if (!checkIfNativeElement(native)) {
|
||||
throw new Error('QScreen cannot be initialised this way.');
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
|
||||
availableGeometry(): QRect {
|
||||
|
||||
@ -3,14 +3,11 @@ import { Component, NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
|
||||
export class QStyle extends Component {
|
||||
native: NativeElement;
|
||||
constructor(native: NativeElement) {
|
||||
super();
|
||||
if (checkIfNativeElement(native)) {
|
||||
this.native = native;
|
||||
} else {
|
||||
if (!checkIfNativeElement(native)) {
|
||||
throw new Error('QStyle cannot be initialised this way. Use QApplication::style()');
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
|
||||
pixelMetric(metric: QStylePixelMetric): number {
|
||||
|
||||
@ -1,20 +1,16 @@
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement, registerNativeWrapFunction } from '../utils/helpers';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QScreen } from './QScreen';
|
||||
import { wrapperCache } from '../core/WrapperCache';
|
||||
import { Edge, Visibility, WindowState } from '../QtEnums';
|
||||
|
||||
export class QWindow extends NodeObject<QWindowSignals> {
|
||||
native: NativeElement;
|
||||
export class QWindow extends QObject<QWindowSignals> {
|
||||
constructor(native: NativeElement) {
|
||||
super(native);
|
||||
|
||||
if (checkIfNativeElement(native)) {
|
||||
this.native = native;
|
||||
} else {
|
||||
if (!checkIfNativeElement(native)) {
|
||||
throw new Error('QWindow cannot be initialised this way.');
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
|
||||
screen(): QScreen {
|
||||
|
||||
@ -6,7 +6,7 @@ import { QIcon } from '../QtGui/QIcon';
|
||||
import { QFont } from '../QtGui/QFont';
|
||||
import { QKeySequence } from '../QtGui/QKeySequence';
|
||||
import { ShortcutContext } from '../QtEnums';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { QVariant } from '../QtCore/QVariant';
|
||||
|
||||
@ -30,13 +30,12 @@ menuAction.addEventListener("triggered", () => {
|
||||
menu.addAction(menuAction);
|
||||
```
|
||||
*/
|
||||
export class QAction extends NodeObject<QActionSignals> {
|
||||
native: NativeElement;
|
||||
export class QAction extends QObject<QActionSignals> {
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NativeElement | NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(parent)) {
|
||||
native = parent as NativeElement;
|
||||
} else if (parent) {
|
||||
@ -45,7 +44,6 @@ export class QAction extends NodeObject<QActionSignals> {
|
||||
native = new addon.QAction();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
}
|
||||
setText(text: string): void {
|
||||
this.native.setText(text);
|
||||
|
||||
@ -26,7 +26,6 @@ centralWidget.setLayout(boxLayout);
|
||||
```
|
||||
*/
|
||||
export class QBoxLayout extends NodeLayout<QBoxLayoutSignals> {
|
||||
native: NativeElement;
|
||||
childLayouts: Set<NodeLayout<any>>;
|
||||
constructor(dir: Direction);
|
||||
constructor(dir: Direction, parent: NodeWidget<any>);
|
||||
@ -39,7 +38,6 @@ export class QBoxLayout extends NodeLayout<QBoxLayoutSignals> {
|
||||
}
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
this.native = native;
|
||||
this.childLayouts = new Set();
|
||||
}
|
||||
addLayout(layout: NodeLayout<any>, stretch = 0): void {
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement, NativeRawPointer } from '../core/Component';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { NativeRawPointer } from '../core/Component';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QAbstractButton, QAbstractButtonSignals } from './QAbstractButton';
|
||||
|
||||
export interface QButtonGroupSignals extends QObjectSignals {
|
||||
buttonClicked: (id?: number) => void;
|
||||
}
|
||||
|
||||
export class QButtonGroup extends NodeObject<any> {
|
||||
native: NativeElement;
|
||||
export class QButtonGroup extends QObject<any> {
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
@ -20,7 +19,6 @@ export class QButtonGroup extends NodeObject<any> {
|
||||
native = new addon.QButtonGroup();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && parent.nodeChildren.add(this);
|
||||
}
|
||||
addButton(button: QAbstractButton<QAbstractButtonSignals>, id = -1): void {
|
||||
|
||||
@ -5,7 +5,7 @@ import { QDate } from '../QtCore/QDate';
|
||||
import { DayOfWeek } from '../QtEnums';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control a selectable monthly calendar.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QCalendarWidget class](https://doc.qt.io/qt-5/qcalendarwidget.html)**
|
||||
@ -22,18 +22,16 @@ const calendarWidget = new QCalendarWidget();
|
||||
```
|
||||
*/
|
||||
export class QCalendarWidget extends NodeWidget<QCalendarWidgetSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QCalendarWidget(parent.native);
|
||||
} else {
|
||||
native = new addon.QCalendarWidget();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setDateEditAcceptDelay(delay: number): void {
|
||||
|
||||
@ -23,7 +23,6 @@ checkbox.setText("Hello");
|
||||
```
|
||||
*/
|
||||
export class QCheckBox extends QAbstractButton<QCheckBoxSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(rawPointer: NativeRawPointer<any>, disableNativeDeletion?: boolean);
|
||||
@ -42,7 +41,6 @@ export class QCheckBox extends QAbstractButton<QCheckBoxSignals> {
|
||||
native = new addon.QCheckBox();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
setTristate(y = true): void {
|
||||
|
||||
@ -5,7 +5,7 @@ import { NodeDialog, QDialogSignals } from './QDialog';
|
||||
import { QColor } from '../QtGui/QColor';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control color dialogs.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QColorDialog class](https://doc.qt.io/qt-5/qcolordialog.html)**
|
||||
@ -27,18 +27,16 @@ console.log(color.red(), color.green(), color.blue());
|
||||
```
|
||||
*/
|
||||
export class QColorDialog extends NodeDialog<QColorDialogSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QColorDialog(parent.native);
|
||||
} else {
|
||||
native = new addon.QColorDialog();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
setCurrentColor(color: QColor): void {
|
||||
|
||||
@ -37,18 +37,16 @@ comboBox.addEventListener('currentIndexChanged', (index) => {
|
||||
```
|
||||
*/
|
||||
export class QComboBox extends NodeWidget<QComboBoxSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QComboBox(parent.native);
|
||||
} else {
|
||||
native = new addon.QComboBox();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
// *** Public Functions ***
|
||||
|
||||
@ -21,18 +21,16 @@ const dateEdit = new QDateEdit();
|
||||
```
|
||||
*/
|
||||
export class QDateEdit extends NodeDateTimeEdit {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QDateEdit(parent.native);
|
||||
} else {
|
||||
native = new addon.QDateEdit();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractSpinBox, QAbstractSpinBoxSignals } from './QAbstractSpinBox';
|
||||
import { QCalendarWidget } from './QCalendarWidget';
|
||||
import { QDate } from '../QtCore/QDate';
|
||||
@ -86,7 +85,6 @@ dateTimeEdit.setTime(time);
|
||||
```
|
||||
*/
|
||||
export class QDateTimeEdit extends NodeDateTimeEdit {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
@ -97,7 +95,6 @@ export class QDateTimeEdit extends NodeDateTimeEdit {
|
||||
native = new addon.QDateTimeEdit();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,18 +20,16 @@ const dial = new QDial();
|
||||
```
|
||||
*/
|
||||
export class QDial extends QAbstractSlider<QDialSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QDial(parent.native);
|
||||
} else {
|
||||
native = new addon.QDial();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
notchSize(): number {
|
||||
|
||||
@ -43,7 +43,6 @@ export abstract class NodeDialog<Signals extends QDialogSignals> extends NodeWid
|
||||
It is inherited by QFileDialog and QMessageBox (n/a QColorDialog, QErrorMessage, QFontDialog, QInputDialog, QMessageBox, QProgressDialog, and QWizard)
|
||||
*/
|
||||
export class QDialog extends NodeDialog<QDialogSignals> {
|
||||
native: NativeElement;
|
||||
constructor(arg?: NodeDialog<QDialogSignals> | NativeElement) {
|
||||
let native;
|
||||
let parent;
|
||||
@ -57,7 +56,6 @@ export class QDialog extends NodeDialog<QDialogSignals> {
|
||||
}
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
this.native = native;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,18 +20,16 @@ const doublespinBox = new QDoubleSpinBox();
|
||||
```
|
||||
*/
|
||||
export class QDoubleSpinBox extends QAbstractSpinBox<QDoubleSpinBoxSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QDoubleSpinBox(parent.native);
|
||||
} else {
|
||||
native = new addon.QDoubleSpinBox();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
cleanText(): string {
|
||||
|
||||
@ -21,18 +21,16 @@ const errorMessage = new QErrorMessage();
|
||||
```
|
||||
*/
|
||||
export class QErrorMessage extends NodeDialog<QErrorMessageSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QErrorMessage(parent.native);
|
||||
} else {
|
||||
native = new addon.QErrorMessage();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
showMessage(message: string): void {
|
||||
|
||||
@ -5,7 +5,7 @@ import { AcceptMode, DialogLabel, FileMode, Option, ViewMode } from '../QtEnums'
|
||||
import { NodeDialog, QDialogSignals } from './QDialog';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control file dialogs.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QFileDialog class](https://doc.qt.io/qt-5/qfiledialog.html)**
|
||||
@ -28,18 +28,16 @@ console.log(selectedFiles);
|
||||
```
|
||||
*/
|
||||
export class QFileDialog extends NodeDialog<QFileDialogSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>, caption?: string, directory?: string, filter?: string);
|
||||
constructor(parent?: NodeWidget<any>, caption = 'Select File', directory = '', filter = '') {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QFileDialog(parent.native, caption, directory, filter);
|
||||
} else {
|
||||
native = new addon.QFileDialog();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
supportedSchemes(): string[] {
|
||||
|
||||
@ -25,18 +25,16 @@ console.log(font);
|
||||
```
|
||||
*/
|
||||
export class QFontDialog extends NodeDialog<QFontDialogSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QFontDialog(parent.native);
|
||||
} else {
|
||||
native = new addon.QFontDialog();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
setCurrentFont(font: QFont): void {
|
||||
|
||||
@ -80,9 +80,8 @@ const frame = new QFrame();
|
||||
```
|
||||
*/
|
||||
export class QFrame extends NodeFrame<QFrameSignals> {
|
||||
native: NativeElement;
|
||||
constructor(arg?: NodeWidget<QWidgetSignals> | NativeElement) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
let parent;
|
||||
if (checkIfNativeElement(arg)) {
|
||||
native = arg as NativeElement;
|
||||
@ -94,6 +93,5 @@ export class QFrame extends NodeFrame<QFrameSignals> {
|
||||
}
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
this.native = native;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { NodeObject } from '../QtCore/QObject';
|
||||
import { QObject } from '../QtCore/QObject';
|
||||
import { QGraphicsEffect, QGraphicsEffectSignals } from './QGraphicsEffect';
|
||||
|
||||
/**
|
||||
@ -22,11 +22,10 @@ blur.setBlurRadius(8);
|
||||
```
|
||||
*/
|
||||
export class QGraphicsBlurEffect extends QGraphicsEffect<QGraphicsBlurEffectSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(parent: NodeObject<any>);
|
||||
constructor(arg?: NodeObject<any> | NativeElement) {
|
||||
constructor(parent: QObject<any>);
|
||||
constructor(arg?: QObject<any> | NativeElement) {
|
||||
let native: NativeElement;
|
||||
if (arg) {
|
||||
if (checkIfNativeElement(arg)) {
|
||||
@ -38,7 +37,6 @@ export class QGraphicsBlurEffect extends QGraphicsEffect<QGraphicsBlurEffectSign
|
||||
native = new addon.QGraphicsBlurEffect();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
}
|
||||
setBlurHints(hints: BlurHint): void {
|
||||
this.setProperty('blurHints', hints);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { NodeObject } from '../QtCore/QObject';
|
||||
import { QObject } from '../QtCore/QObject';
|
||||
import { QGraphicsEffect, QGraphicsEffectSignals } from './QGraphicsEffect';
|
||||
import { QColor } from '../QtGui/QColor';
|
||||
|
||||
@ -23,11 +23,10 @@ shadow.setBlurRadius(8);
|
||||
```
|
||||
*/
|
||||
export class QGraphicsDropShadowEffect extends QGraphicsEffect<QGraphicsDropShadowEffectSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(native: NativeElement);
|
||||
constructor(parent: NodeObject<any>);
|
||||
constructor(arg?: NodeObject<any> | NativeElement) {
|
||||
constructor(parent: QObject<any>);
|
||||
constructor(arg?: QObject<any> | NativeElement) {
|
||||
let native: NativeElement;
|
||||
if (arg) {
|
||||
if (checkIfNativeElement(arg)) {
|
||||
@ -39,7 +38,6 @@ export class QGraphicsDropShadowEffect extends QGraphicsEffect<QGraphicsDropShad
|
||||
native = new addon.QGraphicsDropShadowEffect();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
}
|
||||
setBlurRadius(blurRadius: number): void {
|
||||
this.setProperty('blurRadius', blurRadius);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> This is the abstract base class of graphicseffect, providing their functionality.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QGraphicsEffect class](https://doc.qt.io/qt-5/qgraphicseffect.html)**
|
||||
@ -10,7 +10,7 @@ The QGraphicsEffect class is an abstract class and therefore, technically, no fu
|
||||
It is inherited by QGraphicsBlurEffect, QGraphicsColorizeEffect, QGraphicsDropShadowEffect, and QGraphicsOpacityEffect.
|
||||
|
||||
*/
|
||||
export abstract class QGraphicsEffect<Signals extends QGraphicsEffectSignals> extends NodeObject<Signals> {
|
||||
export abstract class QGraphicsEffect<Signals extends QGraphicsEffectSignals> extends QObject<Signals> {
|
||||
setEnabled(enable: boolean): void {
|
||||
this.setProperty('enabled', enable);
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ layout.addWidget(label2);
|
||||
|
||||
*/
|
||||
export class QGridLayout extends NodeLayout<QGridLayoutSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
@ -42,7 +41,6 @@ export class QGridLayout extends NodeLayout<QGridLayoutSignals> {
|
||||
}
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
this.native = native;
|
||||
}
|
||||
|
||||
addLayout(
|
||||
|
||||
@ -40,18 +40,16 @@ win.show();
|
||||
```
|
||||
*/
|
||||
export class QGroupBox extends NodeWidget<QGroupBoxSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QGroupBox(parent.native);
|
||||
} else {
|
||||
native = new addon.QGroupBox();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setAlignment(alignment: AlignmentFlag): void {
|
||||
|
||||
@ -205,9 +205,8 @@ export abstract class NodeHeaderView<Signals extends QHeaderViewSignals> extends
|
||||
}
|
||||
|
||||
export class QHeaderView extends NodeHeaderView<QHeaderViewSignals> {
|
||||
native: NativeElement;
|
||||
constructor(orientationOrNative: Orientation | NativeElement, parent: NodeWidget<any> | null = null) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(orientationOrNative)) {
|
||||
native = orientationOrNative as NativeElement;
|
||||
} else {
|
||||
@ -218,7 +217,6 @@ export class QHeaderView extends NodeHeaderView<QHeaderViewSignals> {
|
||||
}
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeDialog, QDialogSignals } from './QDialog';
|
||||
import { EchoMode } from './QLineEdit';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control input modal dialogs.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QInputDialog class](https://doc.qt.io/qt-5/qinputdialog.html)**
|
||||
@ -23,9 +22,6 @@ dialog.exec();
|
||||
```
|
||||
*/
|
||||
export class QInputDialog extends NodeDialog<QInputDialogSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -34,7 +30,6 @@ export class QInputDialog extends NodeDialog<QInputDialogSignals> {
|
||||
native = new addon.QInputDialog();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setCancelButtonText(text: string): void {
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control number.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QLCDNumber class](https://doc.qt.io/qt-5/qlcdnumber.html)**
|
||||
@ -21,9 +20,6 @@ const lcd = new QLCDNumber();
|
||||
|
||||
*/
|
||||
export class QLCDNumber extends NodeWidget<QLCDNumberSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -32,7 +28,6 @@ export class QLCDNumber extends NodeWidget<QLCDNumberSignals> {
|
||||
native = new addon.QLCDNumber();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
setDigitCount(numDigits: number): void {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeFrame, QFrameSignals } from './QFrame';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QPixmap } from '../QtGui/QPixmap';
|
||||
import { QMovie } from '../QtGui/QMovie';
|
||||
import { AlignmentFlag } from '../QtEnums/AlignmentFlag';
|
||||
@ -10,7 +9,7 @@ import { TextInteractionFlag } from '../QtEnums';
|
||||
import { QPicture } from '../QtGui/QPicture';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control text.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QLabel class](https://doc.qt.io/qt-5/qlabel.html)**
|
||||
@ -28,13 +27,11 @@ label.setText("Hello");
|
||||
|
||||
*/
|
||||
export class QLabel extends NodeFrame<QLabelSignals> {
|
||||
native: NativeElement;
|
||||
private _picture?: QPicture;
|
||||
private _pixmap?: QPixmap;
|
||||
private _movie?: QMovie;
|
||||
private _buddy?: NodeWidget<any> | null;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -43,7 +40,6 @@ export class QLabel extends NodeFrame<QLabelSignals> {
|
||||
native = new addon.QLabel();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setAlignment(alignment: AlignmentFlag): void {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
|
||||
// All Layouts should extend this abstract class.
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> 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**
|
||||
@ -32,7 +32,7 @@ addChildToLayout(new FlexLayout(), new QPushButton());
|
||||
addChildToLayout(new GridLayout(), new QWidget());
|
||||
```
|
||||
*/
|
||||
export abstract class NodeLayout<Signals extends QLayoutSignals> extends NodeObject<Signals> {
|
||||
export abstract class NodeLayout<Signals extends QLayoutSignals> extends QObject<Signals> {
|
||||
type = 'layout';
|
||||
abstract addWidget(childWidget: NodeWidget<any>, ...args: any[]): void;
|
||||
abstract removeWidget(childWidget: NodeWidget<any>): void;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { AlignmentFlag } from '../QtEnums/AlignmentFlag';
|
||||
import { CursorMoveStyle } from '../QtEnums/CursorMoveStyle';
|
||||
import { QPoint } from '../QtCore/QPoint';
|
||||
@ -23,9 +22,6 @@ const lineEdit = new QLineEdit();
|
||||
|
||||
*/
|
||||
export class QLineEdit extends NodeWidget<QLineEditSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -34,7 +30,6 @@ export class QLineEdit extends NodeWidget<QLineEditSignals> {
|
||||
native = new addon.QLineEdit();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
// TODO: void addAction(QAction *action, QLineEdit::ActionPosition position)
|
||||
|
||||
@ -144,18 +144,16 @@ export enum ListViewMode {
|
||||
}
|
||||
|
||||
export class QListView extends NodeListView<QListViewSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QListView(parent.native);
|
||||
} else {
|
||||
native = new addon.QListView();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,10 +33,8 @@ for (let i = 0; i < 30; i++) {
|
||||
```
|
||||
*/
|
||||
export class QListWidget extends NodeListView<QListWidgetSignals> {
|
||||
native: NativeElement;
|
||||
items: Set<NativeElement | Component>;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -45,7 +43,6 @@ export class QListWidget extends NodeListView<QListWidgetSignals> {
|
||||
native = new addon.QListWidget();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
this.items = new Set();
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import { CheckState } from '../QtEnums';
|
||||
import { ItemFlag } from '../QtEnums/ItemFlag';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Creates an item for QListWidget.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QListWidgetItem class](https://doc.qt.io/qt-5/qlistwidgetitem.html)**
|
||||
@ -35,11 +35,6 @@ for (let i = 0; i < 30; i++) {
|
||||
```
|
||||
*/
|
||||
export class QListWidgetItem extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(other: QListWidgetItem);
|
||||
constructor(native: NativeElement);
|
||||
constructor(text: string);
|
||||
constructor(arg?: QListWidgetItem | NativeElement | string) {
|
||||
let native;
|
||||
if (typeof arg === 'string') {
|
||||
@ -49,8 +44,7 @@ export class QListWidgetItem extends Component {
|
||||
} else {
|
||||
native = new addon.QListWidgetItem();
|
||||
}
|
||||
super();
|
||||
this.native = native;
|
||||
super(native);
|
||||
}
|
||||
setBackground(brush: QBrush): void {
|
||||
this.native.setBackground(brush.native);
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeLayout } from './QLayout';
|
||||
import { QMenuBar } from './QMenuBar';
|
||||
import { QStatusBar } from './QStatusBar';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control windows.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QMainWindow class](https://doc.qt.io/qt-5/qmainwindow.html)**
|
||||
@ -32,21 +32,20 @@ QMainWindow needs to have a central widget set before other widgets can be added
|
||||
Once a central widget is set you can add children/layout to the central widget.
|
||||
*/
|
||||
export class QMainWindow extends NodeWidget<QMainWindowSignals> {
|
||||
native: NativeElement;
|
||||
public centralWidget?: NodeWidget<any> | null;
|
||||
private _menuBar?: QMenuBar;
|
||||
private _statusBar?: QStatusBar | null;
|
||||
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QMainWindow(parent.native);
|
||||
} else {
|
||||
native = new addon.QMainWindow();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
|
||||
this.setLayout = (parentLayout: NodeLayout<any>): void => {
|
||||
@ -115,7 +114,7 @@ export class QMainWindow extends NodeWidget<QMainWindowSignals> {
|
||||
* Returns the status bar for the main window.
|
||||
*/
|
||||
statusBar(): QStatusBar {
|
||||
return this.native.statusBar();
|
||||
return new QStatusBar(this.native.statusBar());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,9 +19,6 @@ const menu = new QMenu();
|
||||
```
|
||||
*/
|
||||
export class QMenu extends NodeWidget<QMenuSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -30,7 +27,6 @@ export class QMenu extends NodeWidget<QMenuSignals> {
|
||||
native = new addon.QMenu();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
clear(): void {
|
||||
|
||||
@ -6,7 +6,7 @@ import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { QAction } from './QAction';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> The QMenuBar class provides a menu widget for use in menu bars, context menus, and other popup menus.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QMenuBar class](https://doc.qt.io/qt-5/qmenu.html)**
|
||||
@ -24,11 +24,8 @@ global.win = win;
|
||||
```
|
||||
*/
|
||||
export class QMenuBar extends NodeWidget<QMenuBarSignals> {
|
||||
native: NativeElement;
|
||||
_menus: Set<QMenu>;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(native: NativeElement);
|
||||
|
||||
constructor(arg?: NodeWidget<any> | NativeElement) {
|
||||
let native;
|
||||
let parent;
|
||||
@ -41,7 +38,6 @@ export class QMenuBar extends NodeWidget<QMenuBarSignals> {
|
||||
native = new addon.QMenuBar();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this._menus = new Set<QMenu>();
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement, NativeRawPointer } from '../core/Component';
|
||||
import { NativeRawPointer } from '../core/Component';
|
||||
import { NodeDialog, QDialogSignals } from './QDialog';
|
||||
import { QAbstractButton, QAbstractButtonSignals } from './QAbstractButton';
|
||||
import { QPushButton } from './QPushButton';
|
||||
@ -19,7 +19,7 @@ export enum ButtonRole {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control classic modal dialogs.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QMessageBox class](https://doc.qt.io/qt-5/qmessagebox.html)**
|
||||
@ -40,9 +40,6 @@ messageBox.exec();
|
||||
```
|
||||
*/
|
||||
export class QMessageBox extends NodeDialog<QMessageBoxSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -51,7 +48,6 @@ export class QMessageBox extends NodeDialog<QMessageBoxSignals> {
|
||||
native = new addon.QMessageBox();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
accept(): void {
|
||||
|
||||
@ -46,18 +46,14 @@ win.show();
|
||||
https://github.com/nodegui/examples/blob/master/nodegui/custom-native-widget-qpainter
|
||||
*/
|
||||
export class QPainter extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(device: Component);
|
||||
constructor(device?: Component) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (device) {
|
||||
native = new addon.QPainter(device.native);
|
||||
} else {
|
||||
native = new addon.QPainter();
|
||||
}
|
||||
super();
|
||||
this.native = native;
|
||||
super(native);
|
||||
}
|
||||
|
||||
// *** Public Functions ***
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import addon from '../utils/addon';
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { Component } from '../core/Component';
|
||||
import { SizeMode, FillRule } from '../QtEnums';
|
||||
import { QFont } from '../QtGui/QFont';
|
||||
|
||||
@ -12,11 +12,8 @@ import { QFont } from '../QtGui/QFont';
|
||||
*/
|
||||
|
||||
export class QPainterPath extends Component {
|
||||
native: NativeElement;
|
||||
constructor() {
|
||||
super();
|
||||
const native = new addon.QPainterPath();
|
||||
this.native = native;
|
||||
super(new addon.QPainterPath());
|
||||
}
|
||||
|
||||
moveTo(x: number, y: number): void {
|
||||
|
||||
@ -32,19 +32,15 @@ const plainTextEdit = new QPlainTextEdit();
|
||||
```
|
||||
*/
|
||||
export class QPlainTextEdit extends QAbstractScrollArea<QPlainTextEditSignals> {
|
||||
native: NativeElement;
|
||||
placeholderText?: string;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QPlainTextEdit(parent.native);
|
||||
} else {
|
||||
native = new addon.QPlainTextEdit();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setPlainText(text: string | number): void {
|
||||
|
||||
@ -20,18 +20,14 @@ const progressBar = new QProgressBar();
|
||||
```
|
||||
*/
|
||||
export class QProgressBar extends NodeWidget<QProgressBarSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QProgressBar(parent.native);
|
||||
} else {
|
||||
native = new addon.QProgressBar();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setAlignment(alignment: AlignmentFlag): void {
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeDialog, QDialogSignals } from './QDialog';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control progress dialogs.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QProgressDialog class](https://doc.qt.io/qt-5/qprogressdialog.html)**
|
||||
@ -21,9 +20,6 @@ const progressDialog = new QProgressDialog();
|
||||
```
|
||||
*/
|
||||
export class QProgressDialog extends NodeDialog<QProgressDialogSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -32,7 +28,6 @@ export class QProgressDialog extends NodeDialog<QProgressDialogSignals> {
|
||||
native = new addon.QProgressDialog();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
setAutoClose(close: boolean): void {
|
||||
|
||||
@ -6,7 +6,7 @@ import { checkIfNativeElement, checkIfNapiExternal } from '../utils/helpers';
|
||||
import { QMenu } from './QMenu';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control buttons.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QPushButton class](https://doc.qt.io/qt-5/qpushbutton.html)**
|
||||
@ -23,12 +23,8 @@ button.setText("Hello");
|
||||
```
|
||||
*/
|
||||
export class QPushButton extends QAbstractButton<QPushButtonSignals> {
|
||||
native: NativeElement;
|
||||
private _menu?: QMenu | null;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(native: NativeElement);
|
||||
constructor(rawPointer: NativeRawPointer<any>, disableNativeDeletion?: boolean);
|
||||
|
||||
constructor(arg?: NodeWidget<any> | NativeRawPointer<any> | NativeElement, disableNativeDeletion = true) {
|
||||
let native;
|
||||
let parent: Component | undefined;
|
||||
@ -44,7 +40,6 @@ export class QPushButton extends QAbstractButton<QPushButtonSignals> {
|
||||
native = new addon.QPushButton();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
setAutoDefault(auto: boolean): void {
|
||||
|
||||
@ -5,7 +5,7 @@ import { QAbstractButton, QAbstractButtonSignals } from './QAbstractButton';
|
||||
import { checkIfNativeElement, checkIfNapiExternal } from '../utils/helpers';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control radio button.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QRadioButton class](https://doc.qt.io/qt-5/qradiobutton.html)**
|
||||
@ -23,10 +23,6 @@ radioButton.setText("Hello");
|
||||
|
||||
*/
|
||||
export class QRadioButton extends QAbstractButton<QRadioButtonSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(rawPointer: NativeRawPointer<any>, disableNativeDeletion?: boolean);
|
||||
constructor(arg?: NodeWidget<any> | NativeRawPointer<any> | NativeElement, disableNativeDeletion = true) {
|
||||
let native;
|
||||
let parent: Component | undefined;
|
||||
@ -42,7 +38,6 @@ export class QRadioButton extends QAbstractButton<QRadioButtonSignals> {
|
||||
native = new addon.QRadioButton();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,19 +29,15 @@ scrollArea.setWidget(imageLabel);
|
||||
```
|
||||
*/
|
||||
export class QScrollArea extends QAbstractScrollArea<QScrollAreaSignals> {
|
||||
native: NativeElement;
|
||||
contentWidget?: NodeWidget<any> | null;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QScrollArea(parent.native);
|
||||
} else {
|
||||
native = new addon.QScrollArea();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setAlignment(alignment: AlignmentFlag): void {
|
||||
|
||||
@ -4,7 +4,7 @@ import { NativeElement } from '../core/Component';
|
||||
import { QAbstractSlider, QAbstractSliderSignals } from './QAbstractSlider';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control scollbar widgets.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QScrollBar class](https://doc.qt.io/qt-5/qscrollbar.html)**
|
||||
@ -20,18 +20,14 @@ const scrollbar = new QScrollBar();
|
||||
```
|
||||
*/
|
||||
export class QScrollBar extends QAbstractSlider<QScrollBarSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QScrollBar(parent.native);
|
||||
} else {
|
||||
native = new addon.QScrollBar();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QKeySequence } from '../QtGui/QKeySequence';
|
||||
import { ShortcutContext } from '../QtEnums';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
|
||||
/**
|
||||
|
||||
@ -29,12 +28,9 @@ global.win = win;
|
||||
global.shortcut = shortcut;
|
||||
```
|
||||
*/
|
||||
export class QShortcut extends NodeObject<QShortcutSignals> {
|
||||
native: NativeElement;
|
||||
export class QShortcut extends QObject<QShortcutSignals> {
|
||||
constructor(parent: NodeWidget<any>) {
|
||||
const native = new addon.QShortcut(parent.native);
|
||||
super(native);
|
||||
this.native = native;
|
||||
super(new addon.QShortcut(parent.native));
|
||||
}
|
||||
setEnabled(enabled: boolean): void {
|
||||
this.native.setEnabled(enabled);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { QWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractSlider, QAbstractSliderSignals } from './QAbstractSlider';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control slider widgets.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QSlider class](https://doc.qt.io/qt-5/qslider.html)**
|
||||
@ -20,18 +20,14 @@ const slider = new QSlider();
|
||||
```
|
||||
*/
|
||||
export class QSlider extends QAbstractSlider<QSliderSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
constructor(parent?: QWidget) {
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QSlider(parent.native);
|
||||
} else {
|
||||
native = new addon.QSlider();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setTickInterval(ti: number): void {
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractSpinBox, QAbstractSpinBoxSignals, StepType } from './QAbstractSpinBox';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> 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)**
|
||||
@ -20,9 +19,6 @@ const spinBox = new QSpinBox();
|
||||
```
|
||||
*/
|
||||
export class QSpinBox extends QAbstractSpinBox<QSpinBoxSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -32,7 +28,6 @@ export class QSpinBox extends QAbstractSpinBox<QSpinBoxSignals> {
|
||||
}
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
this.native = native;
|
||||
}
|
||||
cleanText(): string {
|
||||
return this.property('cleanText').toString();
|
||||
|
||||
@ -35,18 +35,14 @@ splitterHorizontal.addWidget(right);
|
||||
|
||||
*/
|
||||
export class QSplitter extends NodeFrame<QSplitterSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QSplitter(parent.native);
|
||||
} else {
|
||||
native = new addon.QSplitter();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
addWidget(widget: NodeWidget<any>): void {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeFrame, QFrameSignals } from './QFrame';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
/**
|
||||
|
||||
@ -45,9 +44,6 @@ win.show();
|
||||
```
|
||||
*/
|
||||
export class QStackedWidget extends NodeFrame<QStackedWidgetSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -57,7 +53,6 @@ export class QStackedWidget extends NodeFrame<QStackedWidgetSignals> {
|
||||
}
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
this.native = native;
|
||||
}
|
||||
|
||||
// *** Public Function ***
|
||||
|
||||
@ -5,21 +5,21 @@ import { ItemFlag } from '../QtEnums/ItemFlag';
|
||||
import { CheckState } from '../QtEnums';
|
||||
|
||||
export class QStandardItem extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: QStandardItem, text?: string);
|
||||
constructor(native: NativeElement);
|
||||
constructor(parent?: NativeElement | QStandardItem, text?: string) {
|
||||
super();
|
||||
let native: NativeElement;
|
||||
if (checkIfNativeElement(parent)) {
|
||||
this.native = parent as NativeElement;
|
||||
native = parent as NativeElement;
|
||||
} else {
|
||||
if (text) {
|
||||
this.native = new addon.QStandardItem(text);
|
||||
native = new addon.QStandardItem(text);
|
||||
} else {
|
||||
this.native = new addon.QStandardItem();
|
||||
native = new addon.QStandardItem();
|
||||
}
|
||||
}
|
||||
super(native);
|
||||
}
|
||||
setCheckState(state: CheckState): void {
|
||||
this.native.setCheckState(state);
|
||||
|
||||
@ -1,17 +1,13 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QStandardItem } from './QStandardItem';
|
||||
|
||||
export interface QStandardItemModelSignals extends QObjectSignals {
|
||||
itemChanged: (item: QStandardItem) => void;
|
||||
}
|
||||
|
||||
export class QStandardItemModel extends NodeObject<any> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
export class QStandardItemModel extends QObject {
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -20,7 +16,6 @@ export class QStandardItemModel extends NodeObject<any> {
|
||||
native = new addon.QStandardItemModel();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && parent.nodeChildren.add(this);
|
||||
}
|
||||
item(row: number, column = 0): QStandardItem | void {
|
||||
|
||||
@ -7,7 +7,7 @@ export interface QStatusBarSignals extends QWidgetSignals {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control progress bar widgets.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QStatusBar class](https://doc.qt.io/qt-5/qstatusbar.html)**
|
||||
@ -23,11 +23,9 @@ const progressBar = new QStatusBar();
|
||||
```
|
||||
*/
|
||||
export class QStatusBar extends NodeWidget<QStatusBarSignals> {
|
||||
native: NativeElement;
|
||||
permanentWidgets: Set<NativeElement>;
|
||||
widgets: Set<NativeElement>;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -37,7 +35,6 @@ export class QStatusBar extends NodeWidget<QStatusBarSignals> {
|
||||
}
|
||||
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
|
||||
this.permanentWidgets = new Set();
|
||||
|
||||
@ -27,18 +27,16 @@ fs.readFile("icon.svg", (err, buffer) => {
|
||||
|
||||
*/
|
||||
export class QSvgWidget extends NodeWidget<QWidgetSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QSvgWidget(parent.native);
|
||||
} else {
|
||||
native = new addon.QSvgWidget();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
load(file: string | Buffer): void {
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QMenu } from './QMenu';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QObject, QObjectSignals } from '../QtCore/QObject';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control system tray icon.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QSystemTrayIcon class](https://doc.qt.io/qt-5/qsystemtrayicon.html)**
|
||||
@ -28,11 +27,9 @@ tray.show();
|
||||
global.tray = tray; // prevents garbage collection of tray
|
||||
```
|
||||
*/
|
||||
export class QSystemTrayIcon extends NodeObject<QSystemTrayIconSignals> {
|
||||
native: NativeElement;
|
||||
export class QSystemTrayIcon extends QObject<QSystemTrayIconSignals> {
|
||||
contextMenu?: QMenu;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -41,7 +38,6 @@ export class QSystemTrayIcon extends NodeObject<QSystemTrayIconSignals> {
|
||||
native = new addon.QSystemTrayIcon();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
}
|
||||
show(): void {
|
||||
this.native.show();
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { TextElideMode } from '../QtEnums';
|
||||
import { QSize } from '../QtCore/QSize';
|
||||
@ -27,9 +26,6 @@ const tabBar = new QTabBar();
|
||||
```
|
||||
*/
|
||||
export class QTabBar extends NodeWidget<QTabBarSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -38,7 +34,6 @@ export class QTabBar extends NodeWidget<QTabBarSignals> {
|
||||
native = new addon.QTabBar();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
setAutoHide(hide: boolean): void {
|
||||
|
||||
@ -5,12 +5,12 @@ import { QIcon } from '../QtGui/QIcon';
|
||||
import { TabPosition } from '../QtEnums';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control a stack of tabbed widgets.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QTabWidget class](https://doc.qt.io/qt-5/qtabwidget.html)**
|
||||
|
||||
A 'QTabWidget' provides a tab bar and a "page area" that is used to display pages related to each tab.
|
||||
A 'QTabWidget' provides a tab bar and a "page area" that is used to display pages related to each tab.
|
||||
|
||||
### Example
|
||||
|
||||
@ -25,12 +25,10 @@ tabWidget.addTab(new QCalendarWidget(), new QIcon(), 'Tab 2');
|
||||
```
|
||||
*/
|
||||
export class QTabWidget extends NodeWidget<QTabWidgetSignals> {
|
||||
native: NativeElement;
|
||||
tabs: NodeWidget<any>[];
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QTabWidget(parent.native);
|
||||
} else {
|
||||
@ -39,7 +37,6 @@ export class QTabWidget extends NodeWidget<QTabWidgetSignals> {
|
||||
super(native);
|
||||
this.setNodeParent(parent);
|
||||
this.tabs = [];
|
||||
this.native = native;
|
||||
}
|
||||
|
||||
addTab(page: NodeWidget<any>, icon: QIcon, label: string): number {
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { SortOrder, PenStyle } from '../QtEnums';
|
||||
import { QAbstractItemView, QAbstractItemViewSignals } from './QAbstractItemView';
|
||||
import { QHeaderView } from './QHeaderView';
|
||||
@ -179,9 +178,6 @@ export abstract class NodeTableView<Signals extends QTableViewSignals> extends Q
|
||||
}
|
||||
|
||||
export class QTableView extends NodeTableView<QTableViewSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -190,7 +186,6 @@ export class QTableView extends NodeTableView<QTableViewSignals> {
|
||||
native = new addon.QTableView();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,6 @@ win.show();
|
||||
```
|
||||
*/
|
||||
export class QTableWidget extends QAbstractScrollArea<QTableWidgetSignals> {
|
||||
native: NativeElement;
|
||||
items: Set<NativeElement | Component>;
|
||||
constructor(rows: number, columns: number, parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
@ -48,7 +47,6 @@ export class QTableWidget extends QAbstractScrollArea<QTableWidgetSignals> {
|
||||
native = new addon.QTableWidget(rows, columns);
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
this.items = new Set();
|
||||
}
|
||||
|
||||
@ -41,13 +41,12 @@ win.show();
|
||||
|
||||
*/
|
||||
export class QTableWidgetItem extends Component {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(other: QTableWidgetItem);
|
||||
constructor(native: NativeElement);
|
||||
constructor(text: string);
|
||||
constructor(arg?: QTableWidgetItem | NativeElement | string) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (typeof arg === 'string') {
|
||||
native = new addon.QTableWidgetItem(arg);
|
||||
} else if (checkIfNativeElement(arg)) {
|
||||
@ -55,8 +54,7 @@ export class QTableWidgetItem extends Component {
|
||||
} else {
|
||||
native = new addon.QTableWidgetItem();
|
||||
}
|
||||
super();
|
||||
this.native = native;
|
||||
super(native);
|
||||
}
|
||||
setBackground(brush: QBrush): void {
|
||||
this.native.setBackground(brush.native);
|
||||
|
||||
@ -22,18 +22,16 @@ const textBrowser = new QTextBrowser();
|
||||
|
||||
*/
|
||||
export class QTextBrowser extends NodeTextEdit<QTextBrowserSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
let native: NativeElement;
|
||||
if (parent) {
|
||||
native = new addon.QTextBrowser(parent.native);
|
||||
} else {
|
||||
native = new addon.QTextBrowser();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
setOpenExternalLinks(open: boolean): void {
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractScrollArea, QAbstractScrollAreaSignals } from './QAbstractScrollArea';
|
||||
import { AlignmentFlag, TextInteractionFlag } from '../QtEnums';
|
||||
import { QFont } from '../QtGui/QFont';
|
||||
import { QColor } from '../QtGui/QColor';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Create and control editable text field.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QTextEdit class](https://doc.qt.io/qt-5/qtextedit.html)**
|
||||
@ -240,9 +239,6 @@ export enum WrapMode {
|
||||
}
|
||||
|
||||
export class QTextEdit extends NodeTextEdit<QTextEditSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -251,7 +247,6 @@ export class QTextEdit extends NodeTextEdit<QTextEditSignals> {
|
||||
native = new addon.QTextEdit();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeDateTimeEdit } from './QDateTimeEdit';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> Creates a widget to edit dates with spin box layout. WIP!
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QTimeEdit class](https://doc.qt.io/qt-5/qtimeedit.html)**
|
||||
@ -21,9 +20,6 @@ const timeEdit = new QTimeEdit();
|
||||
```
|
||||
*/
|
||||
export class QTimeEdit extends NodeDateTimeEdit {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
let native;
|
||||
if (parent) {
|
||||
@ -32,7 +28,6 @@ export class QTimeEdit extends NodeDateTimeEdit {
|
||||
native = new addon.QTimeEdit();
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user