本文整理汇总了C++中QScriptValue函数的典型用法代码示例。如果您正苦于以下问题:C++ QScriptValue函数的具体用法?C++ QScriptValue怎么用?C++ QScriptValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QScriptValue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: qDBusReplyToScriptValue
QScriptValue qDBusReplyToScriptValue(QScriptEngine *eng, const QDBusReply<T> &reply)
{
return QScriptValue(eng, reply.value());
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:4,代码来源:main.cpp
示例2: qtscript_QSourceLocation_prototype_call
static QScriptValue qtscript_QSourceLocation_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
Q_ASSERT(context->callee().isFunction());
uint _id = context->callee().data().toUInt32();
#else
uint _id;
if (context->callee().isFunction())
_id = context->callee().data().toUInt32();
else
_id = 0xBABE0000 + 8;
#endif
Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
_id &= 0x0000FFFF;
QSourceLocation* _q_self = qscriptvalue_cast<QSourceLocation*>(context->thisObject());
if (!_q_self) {
return context->throwError(QScriptContext::TypeError,
QString::fromLatin1("QSourceLocation.%0(): this object is not a QSourceLocation")
.arg(qtscript_QSourceLocation_function_names[_id+1]));
}
switch (_id) {
case 0:
if (context->argumentCount() == 0) {
qint64 _q_result = _q_self->column();
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 1:
if (context->argumentCount() == 0) {
bool _q_result = _q_self->isNull();
return QScriptValue(context->engine(), _q_result);
}
break;
case 2:
if (context->argumentCount() == 0) {
qint64 _q_result = _q_self->line();
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 3:
if (context->argumentCount() == 1) {
QSourceLocation _q_arg0 = qscriptvalue_cast<QSourceLocation>(context->argument(0));
bool _q_result = _q_self->operator==(_q_arg0);
return QScriptValue(context->engine(), _q_result);
}
break;
case 4:
if (context->argumentCount() == 1) {
qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
_q_self->setColumn(_q_arg0);
return context->engine()->undefinedValue();
}
break;
case 5:
if (context->argumentCount() == 1) {
qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
_q_self->setLine(_q_arg0);
return context->engine()->undefinedValue();
}
break;
case 6:
if (context->argumentCount() == 1) {
QUrl _q_arg0 = qscriptvalue_cast<QUrl>(context->argument(0));
_q_self->setUri(_q_arg0);
return context->engine()->undefinedValue();
}
break;
case 7:
if (context->argumentCount() == 0) {
QUrl _q_result = _q_self->uri();
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 8: {
QString result;
QDebug d(&result);
d << *_q_self;
return QScriptValue(context->engine(), result);
}
default:
Q_ASSERT(false);
}
return qtscript_QSourceLocation_throw_ambiguity_error_helper(context,
qtscript_QSourceLocation_function_names[_id+1],
qtscript_QSourceLocation_function_signatures[_id+1]);
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:96,代码来源:qtscript_QSourceLocation.cpp
示例3: QScriptValue
QScriptValue REcmaSnap::toScriptValueEnumStatus(QScriptEngine* engine, const RSnap::Status& value)
{
return QScriptValue(engine, (int)value);
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:5,代码来源:REcmaSnap.cpp
示例4: qtscript_QWebElement_StyleResolveStrategy_toString
static QScriptValue qtscript_QWebElement_StyleResolveStrategy_toString(QScriptContext *context, QScriptEngine *engine)
{
QWebElement::StyleResolveStrategy value = qscriptvalue_cast<QWebElement::StyleResolveStrategy>(context->thisObject());
return QScriptValue(engine, qtscript_QWebElement_StyleResolveStrategy_toStringHelper(value));
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:5,代码来源:qtscript_QWebElement.cpp
示例5: getSelf
QScriptValue
REcmaSharedPointerLinetype::operator_less
(QScriptContext* context, QScriptEngine* engine)
{
//REcmaHelper::functionStart("REcmaSharedPointerLinetype::operator<", context, engine);
//qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerLinetype::operator<";
//QCoreApplication::processEvents();
QScriptValue result = engine->undefinedValue();
// public function: can be called from ECMA wrapper of ECMA shell:
RLinetype* self =
getSelf("operator<", context);
//Q_ASSERT(self!=NULL);
if (self==NULL) {
return REcmaHelper::throwError("self is NULL", context);
}
if( context->argumentCount() ==
1 && (
context->argument(0).isVariant() ||
context->argument(0).isQObject() ||
context->argument(0).isNull()
) /* type: RLinetype */
){
// prepare arguments:
// argument isCopyable and has default constructor and isSimpleClass
RLinetype*
ap0 =
qscriptvalue_cast<
RLinetype*
>(
context->argument(
0
)
);
if (ap0 == NULL) {
return REcmaHelper::throwError("RLinetype: Argument 0 is not of type RLinetype.",
context);
}
RLinetype
a0 =
*ap0;
// end of arguments
// call C++ function:
// return type 'bool'
bool cppResult =
self->operator<(a0);
// return type: bool
// standard Type
result = QScriptValue(cppResult);
} else
{
return REcmaHelper::throwError("Wrong number/types of arguments for RLinetype.operator_less().",
context);
}
//REcmaHelper::functionEnd("REcmaSharedPointerLinetype::operator<", context, engine);
return result;
}
开发者ID:VixMobile,项目名称:qcad,代码行数:72,代码来源:REcmaSharedPointerLinetype.cpp
示例6: qtscript_QDomImplementation_InvalidDataPolicy_toString
static QScriptValue qtscript_QDomImplementation_InvalidDataPolicy_toString(QScriptContext *context, QScriptEngine *engine)
{
QDomImplementation::InvalidDataPolicy value = qscriptvalue_cast<QDomImplementation::InvalidDataPolicy>(context->thisObject());
return QScriptValue(engine, qtscript_QDomImplementation_InvalidDataPolicy_toStringHelper(value));
}
开发者ID:SSMN,项目名称:MuseScore,代码行数:5,代码来源:qtscript_QDomImplementation.cpp
示例7: qtscript_QAbstractXmlNodeModel_SimpleAxis_toString
static QScriptValue qtscript_QAbstractXmlNodeModel_SimpleAxis_toString(QScriptContext *context, QScriptEngine *engine)
{
QAbstractXmlNodeModel::SimpleAxis value = qscriptvalue_cast<QAbstractXmlNodeModel::SimpleAxis>(context->thisObject());
return QScriptValue(engine, qtscript_QAbstractXmlNodeModel_SimpleAxis_toStringHelper(value));
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:5,代码来源:qtscript_QAbstractXmlNodeModel.cpp
示例8: qtscript_QAbstractXmlNodeModel_NodeCopySetting_toString
static QScriptValue qtscript_QAbstractXmlNodeModel_NodeCopySetting_toString(QScriptContext *context, QScriptEngine *engine)
{
QAbstractXmlNodeModel::NodeCopySetting value = qscriptvalue_cast<QAbstractXmlNodeModel::NodeCopySetting>(context->thisObject());
return QScriptValue(engine, qtscript_QAbstractXmlNodeModel_NodeCopySetting_toStringHelper(value));
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:5,代码来源:qtscript_QAbstractXmlNodeModel.cpp
示例9: getZonesByPosition
bool EntityEditFilters::filter(glm::vec3& position, EntityItemProperties& propertiesIn, EntityItemProperties& propertiesOut,
bool& wasChanged, EntityTree::FilterType filterType, EntityItemID& itemID, EntityItemPointer& existingEntity) {
// get the ids of all the zones (plus the global entity edit filter) that the position
// lies within
auto zoneIDs = getZonesByPosition(position);
for (auto id : zoneIDs) {
if (!itemID.isInvalidID() && id == itemID) {
continue;
}
// get the filter pair, etc...
_lock.lockForRead();
FilterData filterData = _filterDataMap.value(id);
_lock.unlock();
if (filterData.valid()) {
if (filterData.rejectAll) {
return false;
}
// check to see if this filter wants to filter this message type
if ((!filterData.wantsToFilterEdit && filterType == EntityTree::FilterType::Edit) ||
(!filterData.wantsToFilterPhysics && filterType == EntityTree::FilterType::Physics) ||
(!filterData.wantsToFilterDelete && filterType == EntityTree::FilterType::Delete) ||
(!filterData.wantsToFilterAdd && filterType == EntityTree::FilterType::Add)) {
wasChanged = false;
return true; // accept the message
}
auto oldProperties = propertiesIn.getDesiredProperties();
auto specifiedProperties = propertiesIn.getChangedProperties();
propertiesIn.setDesiredProperties(specifiedProperties);
QScriptValue inputValues = propertiesIn.copyToScriptValue(filterData.engine, false, true, true);
propertiesIn.setDesiredProperties(oldProperties);
auto in = QJsonValue::fromVariant(inputValues.toVariant()); // grab json copy now, because the inputValues might be side effected by the filter.
QScriptValueList args;
args << inputValues;
args << filterType;
// get the current properties for then entity and include them for the filter call
if (existingEntity && filterData.wantsOriginalProperties) {
auto currentProperties = existingEntity->getProperties(filterData.includedOriginalProperties);
QScriptValue currentValues = currentProperties.copyToScriptValue(filterData.engine, false, true, true);
args << currentValues;
}
// get the zone properties
if (filterData.wantsZoneProperties) {
auto zoneEntity = _tree->findEntityByEntityItemID(id);
if (zoneEntity) {
auto zoneProperties = zoneEntity->getProperties(filterData.includedZoneProperties);
QScriptValue zoneValues = zoneProperties.copyToScriptValue(filterData.engine, false, true, true);
if (filterData.wantsZoneBoundingBox) {
bool success = true;
AABox aaBox = zoneEntity->getAABox(success);
if (success) {
QScriptValue boundingBox = filterData.engine->newObject();
QScriptValue bottomRightNear = vec3ToScriptValue(filterData.engine, aaBox.getCorner());
QScriptValue topFarLeft = vec3ToScriptValue(filterData.engine, aaBox.calcTopFarLeft());
QScriptValue center = vec3ToScriptValue(filterData.engine, aaBox.calcCenter());
QScriptValue boundingBoxDimensions = vec3ToScriptValue(filterData.engine, aaBox.getDimensions());
boundingBox.setProperty("brn", bottomRightNear);
boundingBox.setProperty("tfl", topFarLeft);
boundingBox.setProperty("center", center);
boundingBox.setProperty("dimensions", boundingBoxDimensions);
zoneValues.setProperty("boundingBox", boundingBox);
}
}
// If this is an add or delete, or original properties weren't requested
// there won't be original properties in the args, but zone properties need
// to be the fourth parameter, so we need to pad the args accordingly
int EXPECTED_ARGS = 3;
if (args.length() < EXPECTED_ARGS) {
args << QScriptValue();
}
assert(args.length() == EXPECTED_ARGS); // we MUST have 3 args by now!
args << zoneValues;
}
}
QScriptValue result = filterData.filterFn.call(_nullObjectForFilter, args);
if (filterData.uncaughtExceptions()) {
return false;
}
if (result.isObject()) {
// make propertiesIn reflect the changes, for next filter...
propertiesIn.copyFromScriptValue(result, false);
// and update propertiesOut too. TODO: this could be more efficient...
propertiesOut.copyFromScriptValue(result, false);
// Javascript objects are == only if they are the same object. To compare arbitrary values, we need to use JSON.
//.........这里部分代码省略.........
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:101,代码来源:EntityEditFilters.cpp
示例10: qtscript_QAbstractXmlNodeModel_SimpleAxis_valueOf
static QScriptValue qtscript_QAbstractXmlNodeModel_SimpleAxis_valueOf(QScriptContext *context, QScriptEngine *engine)
{
QAbstractXmlNodeModel::SimpleAxis value = qscriptvalue_cast<QAbstractXmlNodeModel::SimpleAxis>(context->thisObject());
return QScriptValue(engine, static_cast<int>(value));
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:5,代码来源:qtscript_QAbstractXmlNodeModel.cpp
示例11: qtscript_QStyleOptionProgressBar_StyleOptionVersion_valueOf
static QScriptValue qtscript_QStyleOptionProgressBar_StyleOptionVersion_valueOf(QScriptContext *context, QScriptEngine *engine)
{
QStyleOptionProgressBar::StyleOptionVersion value = qscriptvalue_cast<QStyleOptionProgressBar::StyleOptionVersion>(context->thisObject());
return QScriptValue(engine, static_cast<int>(value));
}
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:5,代码来源:qtscript_QStyleOptionProgressBar.cpp
示例12: qtscript_QStyleOptionProgressBar_StyleOptionType_toString
static QScriptValue qtscript_QStyleOptionProgressBar_StyleOptionType_toString(QScriptContext *context, QScriptEngine *engine)
{
QStyleOptionProgressBar::StyleOptionType value = qscriptvalue_cast<QStyleOptionProgressBar::StyleOptionType>(context->thisObject());
return QScriptValue(engine, qtscript_QStyleOptionProgressBar_StyleOptionType_toStringHelper(value));
}
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:5,代码来源:qtscript_QStyleOptionProgressBar.cpp
示例13: doRedo
void ScriptUndoCommand::doRedo() {
QScriptValueList args;
args << _redoData;
_redoFunction.call(QScriptValue(), args);
}
开发者ID:AlphaStaxLLC,项目名称:hifi,代码行数:5,代码来源:UndoStackScriptingInterface.cpp
示例14: qtscript_QUndoCommand_prototype_call
static QScriptValue qtscript_QUndoCommand_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
Q_ASSERT(context->callee().isFunction());
uint _id = context->callee().data().toUInt32();
#else
uint _id;
if (context->callee().isFunction())
_id = context->callee().data().toUInt32();
else
_id = 0xBABE0000 + 9;
#endif
Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
_id &= 0x0000FFFF;
QUndoCommand* _q_self = qscriptvalue_cast<QUndoCommand*>(context->thisObject());
if (!_q_self) {
return context->throwError(QScriptContext::TypeError,
QString::fromLatin1("QUndoCommand.%0(): this object is not a QUndoCommand")
.arg(qtscript_QUndoCommand_function_names[_id+1]));
}
switch (_id) {
case 0:
if (context->argumentCount() == 0) {
QString _q_result = _q_self->actionText();
return QScriptValue(context->engine(), _q_result);
}
break;
case 1:
if (context->argumentCount() == 1) {
int _q_arg0 = context->argument(0).toInt32();
const QUndoCommand* _q_result = const_cast<const QUndoCommand*>(_q_self->child(_q_arg0));
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 2:
if (context->argumentCount() == 0) {
int _q_result = _q_self->childCount();
return QScriptValue(context->engine(), _q_result);
}
break;
case 3:
if (context->argumentCount() == 0) {
int _q_result = _q_self->id();
return QScriptValue(context->engine(), _q_result);
}
break;
case 4:
if (context->argumentCount() == 1) {
const QUndoCommand* _q_arg0 = qscriptvalue_cast<const QUndoCommand*>(context->argument(0));
bool _q_result = _q_self->mergeWith(_q_arg0);
return QScriptValue(context->engine(), _q_result);
}
break;
case 5:
if (context->argumentCount() == 0) {
_q_self->redo();
return context->engine()->undefinedValue();
}
break;
case 6:
if (context->argumentCount() == 1) {
QString _q_arg0 = context->argument(0).toString();
_q_self->setText(_q_arg0);
return context->engine()->undefinedValue();
}
break;
case 7:
if (context->argumentCount() == 0) {
QString _q_result = _q_self->text();
return QScriptValue(context->engine(), _q_result);
}
break;
case 8:
if (context->argumentCount() == 0) {
_q_self->undo();
return context->engine()->undefinedValue();
}
break;
case 9: {
QString result = QString::fromLatin1("QUndoCommand");
return QScriptValue(context->engine(), result);
}
default:
Q_ASSERT(false);
}
return qtscript_QUndoCommand_throw_ambiguity_error_helper(context,
qtscript_QUndoCommand_function_names[_id+1],
qtscript_QUndoCommand_function_signatures[_id+1]);
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:100,代码来源:qtscript_QUndoCommand.cpp
示例15: qtscript_QAbstractXmlNodeModel_prototype_call
static QScriptValue qtscript_QAbstractXmlNodeModel_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
Q_ASSERT(context->callee().isFunction());
uint _id = context->callee().data().toUInt32();
#else
uint _id;
if (context->callee().isFunction())
_id = context->callee().data().toUInt32();
else
_id = 0xBABE0000 + 12;
#endif
Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
_id &= 0x0000FFFF;
QAbstractXmlNodeModel* _q_self = qscriptvalue_cast<QAbstractXmlNodeModel*>(context->thisObject());
if (!_q_self) {
return context->throwError(QScriptContext::TypeError,
QString::fromLatin1("QAbstractXmlNodeModel.%0(): this object is not a QAbstractXmlNodeModel")
.arg(qtscript_QAbstractXmlNodeModel_function_names[_id+1]));
}
switch (_id) {
case 0:
if (context->argumentCount() == 1) {
QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
QUrl _q_result = _q_self->baseUri(_q_arg0);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 1:
if (context->argumentCount() == 2) {
QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
QXmlNodeModelIndex _q_arg1 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(1));
QXmlNodeModelIndex::DocumentOrder _q_result = _q_self->compareOrder(_q_arg0, _q_arg1);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 2:
if (context->argumentCount() == 1) {
QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
QUrl _q_result = _q_self->documentUri(_q_arg0);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 3:
if (context->argumentCount() == 1) {
QXmlName _q_arg0 = qscriptvalue_cast<QXmlName>(context->argument(0));
QXmlNodeModelIndex _q_result = _q_self->elementById(_q_arg0);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 4:
if (context->argumentCount() == 1) {
QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
QXmlNodeModelIndex::NodeKind _q_result = _q_self->kind(_q_arg0);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 5:
if (context->argumentCount() == 1) {
QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
QXmlName _q_result = _q_self->name(_q_arg0);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 6:
if (context->argumentCount() == 1) {
QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
QVector<QXmlName > _q_result = _q_self->namespaceBindings(_q_arg0);
return qScriptValueFromSequence(context->engine(), _q_result);
}
break;
case 7:
if (context->argumentCount() == 1) {
QXmlName _q_arg0 = qscriptvalue_cast<QXmlName>(context->argument(0));
QVector<QXmlNodeModelIndex > _q_result = _q_self->nodesByIdref(_q_arg0);
return qScriptValueFromSequence(context->engine(), _q_result);
}
break;
case 8:
if (context->argumentCount() == 1) {
QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
QXmlNodeModelIndex _q_result = _q_self->root(_q_arg0);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 9:
if (context->argumentCount() == 1) {
QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
QSourceLocation _q_result = _q_self->sourceLocation(_q_arg0);
return qScriptValueFromValue(context->engine(), _q_result);
//.........这里部分代码省略.........
开发者ID:DanielJSlick,项目名称:qcad,代码行数:101,代码来源:qtscript_QAbstractXmlNodeModel.cpp
示例16: getTitle
QScriptValue
REcmaSharedPointerLinetype::getTitle
(QScriptContext* context, QScriptEngine* engine)
{
//REcmaHelper::functionStart("REcmaSharedPointerLinetype::getTitle", context, engine);
//qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerLinetype::getTitle";
//QCoreApplication::processEvents();
QScriptValue result = engine->undefinedValue();
if( context->argumentCount() ==
1 && (
context->argument(0).isVariant() ||
context->argument(0).isQObject() ||
context->argument(0).isNull()
) /* type: RLinetype */
){
// prepare arguments:
// argument isCopyable and has default constructor and isSimpleClass
RLinetype*
ap0 =
qscriptvalue_cast<
RLinetype*
>(
context->argument(
0
)
);
if (ap0 == NULL) {
return REcmaHelper::throwError("RLinetype: Argument 0 is not of type RLinetype.",
context);
}
RLinetype
a0 =
*ap0;
// end of arguments
// call C++ function:
// return type 'QString'
QString cppResult =
RLinetype::
getTitle(a0);
// return type: QString
// standard Type
result = QScriptValue(cppResult);
} else
{
return REcmaHelper::throwError("Wrong number/types of arguments for RLinetype.getTitle().",
context);
}
//REcmaHelper::functionEnd("REcmaSharedPointerLinetype::getTitle", context, engine);
return result;
}
开发者ID:VixMobile,项目名称:qcad,代码行数:62,代码来源:REcmaSharedPointerLinetype.cpp
示例17: getSelf
QScriptValue
REcmaCircleData::moveReferencePoint
(QScriptContext* context, QScriptEngine* engine)
{
//REcmaHelper::functionStart("REcmaCircleData::moveReferencePoint", context, engine);
//qDebug() << "ECMAScript WRAPPER: REcmaCircleData::moveReferencePoint";
//QCoreApplication::processEvents();
QScriptValue result = engine->undefinedValue();
// public function: can be called from ECMA wrapper of ECMA shell:
RCircleData* self =
getSelf("moveReferencePoint", context);
//Q_ASSERT(self!=NULL);
if (self==NULL) {
return REcmaHelper::throwError("self is NULL", context);
}
if( context->argumentCount() ==
2 && (
context->argument(0).isVariant() ||
context->argument(0).isQObject() ||
context->argument(0).isNull()
) /* type: RVector */
&& (
context->argument(1).isVariant() ||
context->argument(1).isQObject() ||
context->argument(1).isNull()
) /* type: RVector */
){
// prepare arguments:
// argument isCopyable and has default constructor and isSimpleClass
RVector*
ap0 =
qscriptvalue_cast<
RVector*
>(
context->argument(
0
)
);
if (ap0 == NULL) {
return REcmaHelper::throwError("RCircleData: Argument 0 is not of type RVector.",
context);
}
RVector
a0 =
*ap0;
// argument isCopyable and has default constructor and isSimpleClass
RVector*
ap1 =
qscriptvalue_cast<
RVector*
>(
context->argument(
1
)
);
if (ap1 == NULL) {
return REcmaHelper::throwError("RCircleData: Argument 1 is not of type RVector.",
context);
}
RVector
a1 =
*ap1;
// end of arguments
// call C++ function:
// return type 'bool'
bool cppResult =
self->moveReferencePoint(a0
,
a1);
// return type: bool
// standard Type
result = QScriptValue(cppResult);
} else
{
return REcmaHelper::throwError("Wrong number/types of arguments for RCircleData.moveReferencePoint().",
context);
}
//REcmaHelper::functionEnd("REcmaCircleData::moveReferencePoint", context, engine);
return result;
}
开发者ID:fallenwind,项目名称:qcad,代码行数:97,代码来源:REcmaCircleData.cpp
示例18: qtscript_QDomImplementation_InvalidDataPolicy_valueOf
static QScriptValue qtscript_QDomImplementation_InvalidDataPolicy_valueOf(QScriptContext *context, QScriptEngine *engine)
{
QDomImplementation::InvalidDataPolicy value = qscriptvalue_cast<QDomImplementation::InvalidDataPolicy>(context->thisObject());
return QScriptValue(engine, static_cast<int>(value));
}
开发者ID:SSMN,项目名称:MuseScore,代码行数:5,代码来源:qtscript_QDomImplementation.cpp
示例19: QImage
QImage Plotter::makeHistro()
{
QImage img= QImage(width,height,QImage::Format_RGB32);
img.fill(0xffffff);
QPainter painter(&img);
painter.setFont(QFont(painter.font().family(),_fs));
float step_x=float(width/(_text_x.length()+1));
float max = float(scriptEngine->evaluate("Math.max.apply( Math, results );").toNumber());
float step_y=float(height)/max;
float ident_right=step_x/2;
float ident_left=ident_right;
float ident_top=step_y+_fs*2;
float ident_bottom=step_y+_fs*2;
int dataCount = scriptEngine->evaluate("results.length").toInt32();
step_x=(width-ident_left-ident_right)/float(dataCount);
step_y=(height-ident_bottom-ident_top)/max;
QVector<QRectF> rects;
QStringList text_up;
QList<QPointF> text_up_pos;
QList<QPointF> text_down_pos;
QFontMetrics metrics=QFontMetrics(painter.font());
QString num;
for(int i=0; i<dataCount; i++)
{
QScriptValue index = QScriptValue(i);
scriptEngine->globalObject().setProperty("index",index);
float curResult = (float)scriptEngine->evaluate("results[index]").toNumber();
rects.append(QRectF(ident_left+i*step_x,height-(ident_bottom+curResult*step_y),step_x,curResult*step_y));
num.setNum(curResult);
text_up_pos.append(QPointF(ident_left+i*step_x+step_x/2-metrics.width(num)/2,height-(ident_bottom+curResult*step_y-_fs-_fs/2)));
text_down_pos.append(QPointF(ident_left+i*step_x+step_x/2-metrics.width(_text_x[i])/2,height-ident_bottom+1.5*_fs));
num.setNum(curResult);
text_up.append(num);
}
QLine max_line;
QString max_text=QString::fromUtf8("Максимум: ");
QPointF max_text_pos;
if(_maximum!=0)
{
if(_maximum<max)
_maximum=max;
max_line=QLine(ident_left,height-_maximum*step_y-ident_bottom,width-ident_right,height-_maximum*step_y-ident_bottom);
num.setNum(_maximum);
max_text.append(num);
max_text_pos=QPointF(width/2-metrics.width(max_text)/2,height-_maximum*step_y-_fs/2-ident_bottom);
}
QPen pen=QPen(Qt::black,2);
QBrush brush1=QBrush(Qt::lightGray);
QBrush brush2=QBrush(Qt::lightGray);
if(_difcol==true)
brush2=QBrush(Qt::gray);
painter.setPen(pen);
painter.setBrush(brush1);
QStringList sl = _text_x.split(";",QString::SkipEmptyParts,Qt::CaseSensitive);
for(int i=0; i<rects.size(); i++)
{
if(_difcol==true)
{
if(i%2==0)//если чётное
painter.setBrush(brush1);
else if(i%2!=0)
painter.setBrush(brush2);
painter.drawRect(rects[i]);
}
if(i<sl.size())
painter.drawText(text_down_pos[i],QString(sl[i]));
painter.drawText(text_up_pos[i],QString(text_up[i]));
}
if(_difcol==false)
painter.drawRects(rects);
if(_maximum!=0)
{
painter.drawLine(max_line);
painter.drawText(max_text_pos,max_text);
}
return img;
}
开发者ID:ASGAlex,项目名称:openpsy,代码行数:95,代码来源:plotter.cpp
示例20: qtscript_QDomImplementation_prototype_call
static QScriptValue qtscript_QDomImplementation_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
Q_ASSERT(context->callee().isFunction());
uint _id = context->callee().data().toUInt32();
#else
uint _id;
if (context->callee().isFunction())
_id = context->callee().data().toUInt32();
else
_id = 0xBABE0000 + 5;
#endif
Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
_id &= 0x0000FFFF;
QDomImplementation* _q_self = qscriptvalue_cast<QDomImplementation*>(context->thisObject());
if (!_q_self) {
return context->throwError(QScriptContext::TypeError,
QString::fromLatin1("QDomImplementation.%0(): this object is not a QDomImplementation")
.arg(qtscript_QDomImplementation_function_names[_id+1]));
}
switch (_id) {
case 0:
if (context->argumentCount() == 3) {
QString _q_arg0 = context->argument(0).toString();
QString _q_arg1 = context->argument(1).toString();
QDomDocumentType _q_arg2 = qscriptvalue_cast<QDomDocumentType>(context->argument(2));
QDomDocument _q_result = _q_self->createDocument(_q_arg0, _q_arg1, _q_arg2);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 1:
if (context->argumentCount() == 3) {
QString _q_arg0 = context->argument(0).toString();
QString _q_arg1 = context->argument(1).toString();
QString _q_arg2 = context->argument(2).toString();
QDomDocumentType _q_result = _q_self->createDocumentType(_q_arg0, _q_arg1, _q_arg2);
return qScriptValueFromValue(context->engine(), _q_result);
}
break;
case 2:
if (context->argumentCount() == 2) {
QString _q_arg0 = context->argument(0).toString();
QString _q_arg1 = context->argument(1).toString();
bool _q_result = _q_self->hasFeature(_q_arg0, _q_arg1);
return QScriptValue(context->engine(), _q_result);
}
break;
case 3:
if (context->argumentCount() == 0) {
bool _q_result = _q_self->isNull();
return QScriptValue(context->engine(), _q_result);
}
break;
case 4:
if (context->argumentCount() == 1) {
QDomImplementation _q_arg0 = qscriptvalue_cast<QDomImplementation>(context->argument(0));
bool _q_result = _q_self->operator==(_q_arg0);
return QScriptValue(context->engine(), _q_result);
}
break;
case 5: {
QString result = QString::fromLatin1("QDomImplementation");
return QScriptValue(context->engine(), result);
}
default:
Q_ASSERT(false);
}
return qtscript_QDomImplementation_throw_ambiguity_error_helper(context,
qtscript_QDomImplementation_function_names[_id+3],
qtscript_QDomImplementation_function_signatures[_id+3]);
}
开发者ID:SSMN,项目名称:MuseScore,代码行数:78,代码来源:qtscript_QDomImplementation.cpp
注:本文中的QScriptValue函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论