本文整理汇总了C++中QScriptValue::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptValue::property方法的具体用法?C++ QScriptValue::property怎么用?C++ QScriptValue::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptValue
的用法示例。
在下文中一共展示了QScriptValue::property方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qtscript_QStyleOptionRubberBand_StyleOptionType_toScriptValue
static QScriptValue qtscript_QStyleOptionRubberBand_StyleOptionType_toScriptValue(QScriptEngine *engine, const QStyleOptionRubberBand::StyleOptionType &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QStyleOptionRubberBand"));
return clazz.property(qtscript_QStyleOptionRubberBand_StyleOptionType_toStringHelper(value));
}
示例2: qtscript_QComboBox_SizeAdjustPolicy_toScriptValue
static QScriptValue qtscript_QComboBox_SizeAdjustPolicy_toScriptValue(QScriptEngine *engine, const QComboBox::SizeAdjustPolicy &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QComboBox"));
return clazz.property(qtscript_QComboBox_SizeAdjustPolicy_toStringHelper(value));
}
示例3: qtscript_QPrintEngine_PrintEnginePropertyKey_toScriptValue
static QScriptValue qtscript_QPrintEngine_PrintEnginePropertyKey_toScriptValue(QScriptEngine *engine, const QPrintEngine::PrintEnginePropertyKey &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QPrintEngine"));
return clazz.property(qtscript_QPrintEngine_PrintEnginePropertyKey_toStringHelper(value));
}
示例4: cursorFromScriptValue
/** Conversion function from QtScript cursor to KTextEditor::Cursor */
static void cursorFromScriptValue(const QScriptValue &obj, KTextEditor::Cursor &cursor)
{
cursor.setPosition(obj.property("line").toInt32(),
obj.property("column").toInt32());
}
示例5:
static QScriptValue qtscript_QStyleOptionProgressBarV2_StyleOptionVersion_toScriptValue(QScriptEngine *engine, const QStyleOptionProgressBarV2::StyleOptionVersion &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QStyleOptionProgressBarV2"));
return clazz.property(qtscript_QStyleOptionProgressBarV2_StyleOptionVersion_toStringHelper(value));
}
示例6: vec2FromScriptValue
void vec2FromScriptValue(const QScriptValue &object, glm::vec2 &vec2) {
vec2.x = object.property("x").toVariant().toFloat();
vec2.y = object.property("y").toVariant().toFloat();
}
示例7: qtscript_QGradient_CoordinateMode_toScriptValue
static QScriptValue qtscript_QGradient_CoordinateMode_toScriptValue(QScriptEngine *engine, const QGradient::CoordinateMode &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QGradient"));
return clazz.property(qtscript_QGradient_CoordinateMode_toStringHelper(value));
}
示例8: qtscript_QtConcurrent_ThreadFunctionResult_toScriptValue
static QScriptValue qtscript_QtConcurrent_ThreadFunctionResult_toScriptValue(QScriptEngine *engine, const QtConcurrent::ThreadFunctionResult &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QtConcurrent"));
return clazz.property(qtscript_QtConcurrent_ThreadFunctionResult_toStringHelper(value));
}
示例9: setProperties
void TextOverlay::setProperties(const QScriptValue& properties) {
Overlay2D::setProperties(properties);
_qmlElement->setX(_bounds.left());
_qmlElement->setY(_bounds.top());
_qmlElement->setWidth(_bounds.width());
_qmlElement->setHeight(_bounds.height());
_qmlElement->settextColor(toQmlColor(vec4(toGlm(_color), _alpha)));
QScriptValue font = properties.property("font");
if (font.isObject()) {
if (font.property("size").isValid()) {
setFontSize(font.property("size").toInt32());
}
QFont font(_qmlElement->fontFamily());
font.setPixelSize(_qmlElement->fontSize());
QFontMetrics fm(font);
_qmlElement->setlineHeight(fm.lineSpacing() * 1.2);
}
QScriptValue text = properties.property("text");
if (text.isValid()) {
setText(text.toVariant().toString());
}
QScriptValue backgroundColor = properties.property("backgroundColor");
if (backgroundColor.isValid()) {
QScriptValue red = backgroundColor.property("red");
QScriptValue green = backgroundColor.property("green");
QScriptValue blue = backgroundColor.property("blue");
if (red.isValid() && green.isValid() && blue.isValid()) {
_backgroundColor.red = red.toVariant().toInt();
_backgroundColor.green = green.toVariant().toInt();
_backgroundColor.blue = blue.toVariant().toInt();
}
}
if (properties.property("backgroundAlpha").isValid()) {
_backgroundAlpha = properties.property("backgroundAlpha").toVariant().toFloat();
}
_qmlElement->setbackgroundColor(toQmlColor(vec4(toGlm(_backgroundColor), _backgroundAlpha)));
if (properties.property("leftMargin").isValid()) {
setLeftMargin(properties.property("leftMargin").toVariant().toInt());
}
if (properties.property("topMargin").isValid()) {
setTopMargin(properties.property("topMargin").toVariant().toInt());
}
}
示例10: qtscript_QStyleOptionMenuItem_MenuItemType_toScriptValue
static QScriptValue qtscript_QStyleOptionMenuItem_MenuItemType_toScriptValue(QScriptEngine *engine, const QStyleOptionMenuItem::MenuItemType &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QStyleOptionMenuItem"));
return clazz.property(qtscript_QStyleOptionMenuItem_MenuItemType_toStringHelper(value));
}
示例11: qtscript_QtConcurrent_ReduceOption_toScriptValue
static QScriptValue qtscript_QtConcurrent_ReduceOption_toScriptValue(QScriptEngine *engine, const QtConcurrent::ReduceOption &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QtConcurrent"));
return clazz.property(qtscript_QtConcurrent_ReduceOption_toStringHelper(value));
}
示例12: qtscript_QPainterPath_ElementType_toScriptValue
static QScriptValue qtscript_QPainterPath_ElementType_toScriptValue(QScriptEngine *engine, const QPainterPath::ElementType &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QPainterPath"));
return clazz.property(qtscript_QPainterPath_ElementType_toStringHelper(value));
}
示例13: qtscript_QDockWidget_DockWidgetFeature_toScriptValue
static QScriptValue qtscript_QDockWidget_DockWidgetFeature_toScriptValue(QScriptEngine *engine, const QDockWidget::DockWidgetFeature &value)
{
QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QDockWidget"));
return clazz.property(qtscript_QDockWidget_DockWidgetFeature_toStringHelper(value));
}
示例14: val
//! [0]
//! [1]
QScriptValue val(&myEngine, 123);
myObject.setProperty("myReadOnlyProperty", val, QScriptValue::ReadOnly);
//! [1]
//! [2]
QScriptEngine engine;
engine.evaluate("function fullName() { return this.firstName + ' ' + this.lastName; }");
engine.evaluate("somePerson = { firstName: 'John', lastName: 'Doe' }");
QScriptValue global = engine.globalObject();
QScriptValue fullName = global.property("fullName");
QScriptValue who = global.property("somePerson");
qDebug() << fullName.call(who).toString(); // "John Doe"
engine.evaluate("function cube(x) { return x * x * x; }");
QScriptValue cube = global.property("cube");
QScriptValueList args;
args << 3;
qDebug() << cube.call(QScriptValue(), args).toNumber(); // 27
//! [2]
//! [3]
QScriptValue myNativeFunction(QScriptContext *ctx, QScriptEngine *)
{
QScriptValue otherFunction = ...;
示例15: vec4FromScriptValue
void vec4FromScriptValue(const QScriptValue& object, glm::vec4& vec4) {
vec4.x = object.property("x").toVariant().toFloat();
vec4.y = object.property("y").toVariant().toFloat();
vec4.z = object.property("z").toVariant().toFloat();
vec4.w = object.property("w").toVariant().toFloat();
}