UNPKG

@nodegui/nodegui

Version:

A cross-platform library to build native desktop apps.

105 lines (98 loc) 2.95 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.QDoubleSpinBox = void 0; const addon_1 = __importDefault(require("../utils/addon")); const QAbstractSpinBox_1 = require("./QAbstractSpinBox"); const helpers_1 = require("../utils/helpers"); const WrapperCache_1 = require("../core/WrapperCache"); /** > Create and control double spin box widgets. * **This class is a JS wrapper around Qt's [QDoubleSpinBox class](https://doc.qt.io/qt-5/qdoublespinbox.html)** A `QDoubleSpinBox` provides ability to add and manipulate native double spin box widgets. ### Example ```javascript const { QDoubleSpinBox } = require("@nodegui/nodegui"); const doublespinBox = new QDoubleSpinBox(); ``` */ class QDoubleSpinBox extends QAbstractSpinBox_1.QAbstractSpinBox { constructor(arg) { let native; if ((0, helpers_1.checkIfNativeElement)(arg)) { native = arg; } else if (arg != null) { const parent = arg; native = new addon_1.default.QDoubleSpinBox(parent.native); } else { native = new addon_1.default.QDoubleSpinBox(); } super(native); } cleanText() { return this.property('cleanText').toString(); } setDecimals(prec) { this.setProperty('decimals', prec); } decimals() { return this.property('decimals').toInt(); } setMaximum(max) { this.setProperty('maximum', max); } maximum() { return this.property('maximum').toDouble(); } setMinimum(min) { this.setProperty('minimum', min); } minimum() { return this.property('minimum').toDouble(); } setPrefix(prefix) { this.setProperty('prefix', prefix); } prefix() { return this.property('prefix').toString(); } setSingleStep(val) { this.setProperty('singleStep', val); } singleStep() { return this.property('singleStep').toDouble(); } setStepType(stepType) { this.setProperty('stepType', stepType); } stepType() { return this.property('stepType').toInt(); } setSuffix(suffix) { this.setProperty('suffix', suffix); } suffix() { return this.property('suffix').toString(); } setValue(val) { this.setProperty('value', val); } value() { return this.property('value').toDouble(); } setRange(minimum, maximum) { this.native.setRange(minimum, maximum); } textFromValue(value) { return this.native.textFromValue(value); } valueFromText(text) { return this.native.valueFromText(text); } } exports.QDoubleSpinBox = QDoubleSpinBox; WrapperCache_1.wrapperCache.registerWrapper('QDoubleSpinBoxWrap', QDoubleSpinBox);