Редактирование: Qt:Документация 4.3.2/qtscript
Материал из Wiki.crossplatform.ru
Внимание: Вы не представились системе. Ваш IP-адрес будет записан в историю изменений этой страницы.
ПРЕДУПРЕЖДЕНИЕ: Длина этой страницы составляет 58 килобайт. Страницы, размер которых приближается к 32 КБ или превышает это значение, могут неверно отображаться в некоторых браузерах. Пожалуйста, рассмотрите вариант разбиения страницы на меньшие части.
Правка может быть отменена. Пожалуйста, просмотрите сравнение версий, чтобы убедиться, что это именно те изменения, которые вас интересуют, и нажмите «Записать страницу», чтобы изменения вступили в силу.
Текущая версия | Ваш текст | ||
Строка 631: | Строка 631: | ||
===Qt Script Extensions to ECMAScript=== | ===Qt Script Extensions to ECMAScript=== | ||
- | *<tt>__proto__</tt> <br /> The prototype of an object ([[Qt:Документация 4.3.2/qscriptvalue#prototype | QScriptValue::prototype]]()) can be accessed through its <tt>__proto__</tt> property in script code. This property has the [[Qt:Документация 4.3.2/qscriptvalue#PropertyFlag-enum | QScriptValue::Undeletable]] flag set. For example: | + | *<tt>__proto__</tt> <br /> The prototype of an object ([[Qt:Документация 4.3.2/qscriptvalue#prototype | QScriptValue::prototype]]()) can be accessed through its <tt>__proto__</tt> property in script code. This property has the [[Qt:Документация 4.3.2/qscriptvalue#PropertyFlag-enum | QScriptValue::Undeletable]] flag set. For example:<source lang="cpp-qt"> var o = new Object(); (o.__proto__ === Object.prototype); // this evaluates to true</source> |
- | <source lang="cpp-qt"> | + | *<tt>Object.prototype.__defineGetter__</tt> <br /> This function installs a getter function for a property of an object. The first argument is the property name, and the second is the function to call to get the value of that property. When the function is invoked, the <tt>this</tt> object will be the object whose property is accessed. For example:<source lang="cpp-qt"> var o = new Object(); o.__defineGetter__("x", function() { return 123; }); var y = o.x; // 123</source> |
- | + | *<tt>Object.prototype.__defineSetter__</tt> <br /> This function installs a setter function for a property of an object. The first argument is the property name, and the second is the function to call to set the value of that property. When the function is invoked, the <tt>this</tt> object will be the object whose property is accessed. For example:<source lang="cpp-qt"> var o = new Object(); o.__defineSetter__("x", function(v) { print("and the value is:", v); }); o.x = 123; // will print "and the value is: 123"</source> | |
- | + | ||
- | </source> | + | |
- | *<tt>Object.prototype.__defineGetter__</tt> <br /> This function installs a getter function for a property of an object. The first argument is the property name, and the second is the function to call to get the value of that property. When the function is invoked, the <tt>this</tt> object will be the object whose property is accessed. For example: | + | |
- | <source lang="cpp-qt"> | + | |
- | + | ||
- | + | ||
- | + | ||
- | </source> | + | |
- | *<tt>Object.prototype.__defineSetter__</tt> <br /> This function installs a setter function for a property of an object. The first argument is the property name, and the second is the function to call to set the value of that property. When the function is invoked, the <tt>this</tt> object will be the object whose property is accessed. For example: | + | |
- | <source lang="cpp-qt"> | + | |
- | + | ||
- | + | ||
- | + | ||
- | </source> | + | |
*<tt>Function.prototype.connect</tt> <br /> This function connects a signal to a slot. Usage of this function is described in the section [[#using-signals-and-slots | Using Сигналы and Slots]]. | *<tt>Function.prototype.connect</tt> <br /> This function connects a signal to a slot. Usage of this function is described in the section [[#using-signals-and-slots | Using Сигналы and Slots]]. | ||
*<tt>Function.prototype.disconnect</tt> <br /> This function disconnects a signal from a slot. Usage of this function is described in the section [[#using-signals-and-slots | Using Сигналы and Slots]]. | *<tt>Function.prototype.disconnect</tt> <br /> This function disconnects a signal from a slot. Usage of this function is described in the section [[#using-signals-and-slots | Using Сигналы and Slots]]. |