当前位置: 首页>>代码示例>>C++>>正文


C++ QScriptValue::isNull方法代码示例

本文整理汇总了C++中QScriptValue::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptValue::isNull方法的具体用法?C++ QScriptValue::isNull怎么用?C++ QScriptValue::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QScriptValue的用法示例。


在下文中一共展示了QScriptValue::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: propertyBindingFromScriptValue

void propertyBindingFromScriptValue(const QScriptValue& object, PropertyBinding& value) {
    QScriptValue avatar = object.property("avatar");
    QScriptValue entity = object.property("entity");

    if (avatar.isValid() && !avatar.isNull()) {
        value.avatar = avatar.toVariant().toString();
    } else if (entity.isValid() && !entity.isNull()) {
        value.entity = entity.toVariant().toUuid();
    }
}
开发者ID:AaronHillaker,项目名称:hifi,代码行数:10,代码来源:OverlayPanel.cpp

示例2: to_source_f_object

    QString to_source_f<QScriptValue>::operator()( QScriptValue const & x ) const
    {
	if( x.isUndefined() ) return "undefined";
	if( x.isNull() ) return "null";
	if(0) qDebug() << "to_source_f<QScriptValue>("<<x.toString()<<")";

#define TODO(A,B,C)
#define DO(IS,T,TO) \
	if( x.IS() ) {\
	    if(0) qDebug() << "to_source_f<QScriptValue>(is-a: "<<# IS<<")"; \
	    return toSource<T>( x.TO() );\
	}


	DO(isVariant,QVariant,toVariant); // must come before the others!
	DO(isBoolean,bool,toBoolean);
	DO(isNumber,qreal,toNumber);
	DO(isString,QString,toString);
	TODO(isRegExp,QRegExp,toRegExp);
	if( x.isArray() || x.isObject() )
	{
	    if(0) qDebug() << "to_source_f<QScriptValue>(is-a: array or object)";
	    return to_source_f_object()( x );
	}

#undef DO
#undef TODO
	return QString("undefined");
    }
开发者ID:Mr-Kumar-Abhishek,项目名称:qboard,代码行数:29,代码来源:ScriptQt.cpp

示例3: qCritical

/* Check for uncaught exceptions. Return true and print stuff if
 * there were any.
 */
bool
JavaScriptExtension::_hasError(QScriptValue evalReturnValue) const
{
    if (this->_engine.isNull())
    {
        qCritical() << "JavaScriptExtension::_hasError(): "
		    << "Called without engine!";
        return true;
    }
    if (! this->_engine.data()->hasUncaughtException())
        return false;

    QString retvalstr = (evalReturnValue.isNull()
			 ? "In"
			 : evalReturnValue.toString() + " in");

    qWarning() << "JavaScriptExtension::_hasError():" << retvalstr
               << "source for" << this->_definition->id()
               << "line" << this->_engine.data()->uncaughtExceptionLineNumber();
    qWarning() << "  " << this->_engine.data()->uncaughtException().toString();
    qWarning() << "Trace follows:";
    foreach(QString line, this->_engine.data()->uncaughtExceptionBacktrace())
        qWarning() << "  |" << line;

    return true;
}
开发者ID:simio,项目名称:H.VHS,代码行数:29,代码来源:javascriptextension.cpp

示例4: fromScriptValueEntityReference

void fromScriptValueEntityReference(const QScriptValue &obj, EntityReference &s)
{
    if (obj.isString())
        s.ref = obj.toString();
    else
    {
        if (!obj.property("ref").isValid())
            LogError("Can't convert QScriptValue to EntityReference! QScriptValue does not contain ref attribute!");
        else
        {
            QScriptValue ref = obj.property("ref");
            if (ref.isNull())
                s.ref = ""; // Empty the reference
            else if (ref.isString())
                s.ref = ref.toString();
            else if (ref.isQObject())
            {
                // If the object is an Entity, call EntityReference::Set() with it
                Entity* entity = dynamic_cast<Entity*>(ref.toQObject());
                s.Set(entity);
            }
            else if (ref.isNumber() || ref.isVariant())
                s.ref = QString::number(ref.toInt32());
            else
                LogError("Can't convert QScriptValue to EntityReference! Ref attribute is not null, string, a number, or an entity");
        }
    }
}
开发者ID:katik,项目名称:naali,代码行数:28,代码来源:ScriptCoreTypeDefines.cpp

示例5: invoke

QString KateTemplateScript::invoke(KateView* view, const QString& functionName, const QString &srcText) {

  if(!setView(view))
    return QString();

  clearExceptions();
  QScriptValue myFunction = function(functionName);
  if(!myFunction.isValid()) {
    return QString();
  }

  QScriptValueList arguments;
  arguments << QScriptValue(m_engine, srcText);

  QScriptValue result = myFunction.call(QScriptValue(), arguments);
  
  if(m_engine->hasUncaughtException()) {
    displayBacktrace(result, "Error while calling helper function");
    return QString();
  }
 
  
  if (result.isNull()) {
    return QString();
  }

  return result.toString();
}
开发者ID:UIKit0,项目名称:kate,代码行数:28,代码来源:katetemplatescript.cpp

示例6: QScriptEngine

SkinContext::SkinContext(UserSettingsPointer pConfig,
                         const QString& xmlPath)
        : m_xmlPath(xmlPath),
          m_pConfig(pConfig),
          m_pScriptEngine(new QScriptEngine()),
          m_pScriptDebugger(new QScriptEngineDebugger()),
          m_pSvgCache(new QHash<QString, QDomElement>()),
          m_pSingletons(new SingletonMap()) {
    enableDebugger(true);
    // the extensions are imported once and will be passed to the children
    // global object as properties of the parent's global object.
    importScriptExtension("console");
    importScriptExtension("svg");
    m_pScriptEngine->installTranslatorFunctions();

    // Retrieving hooks pattern from script extension
    QScriptValue global = m_pScriptEngine->globalObject();
    QScriptValue svg = global.property("svg");
    QScriptValue hooksPattern = svg.property("getHooksPattern").call(svg);
    if (!hooksPattern.isNull()) {
        m_hookRx.setPattern(hooksPattern.toString());
    }

    m_scaleFactor = 1.0;
}
开发者ID:mixxxdj,项目名称:mixxx,代码行数:25,代码来源:skincontext.cpp

示例7: setting

QScriptValue Plugin::setting(const QString& name, const QScriptValue& defaultValue) {
	mv::Settings settings;
	settings.beginGroup("plugins/" + plugin_->id());
	QVariant v = settings.value(name);
	if (v.isNull() && !defaultValue.isNull()) {
		return defaultValue;
	}
	return mv::scriptutil::variantToScriptValue(v);
}
开发者ID:wyrover,项目名称:akview,代码行数:9,代码来源:jsapi_plugin.cpp

示例8: quuidFromScriptValue

void quuidFromScriptValue(const QScriptValue& object, QUuid& uuid) {
    if (object.isNull()) {
        uuid = QUuid();
        return;
    }
    QString uuidAsString = object.toVariant().toString();
    QUuid fromString(uuidAsString);
    uuid = fromString;
}
开发者ID:disigma,项目名称:hifi,代码行数:9,代码来源:RegisteredMetaTypes.cpp

示例9: fromScriptValue

static JSAgentWatchData fromScriptValue(const QString &expression,
                                        const QScriptValue &value)
{
    static const QString arrayStr = QCoreApplication::translate
            ("Debugger::JSAgentWatchData", "[Array of length %1]");
    static const QString undefinedStr = QCoreApplication::translate
            ("Debugger::JSAgentWatchData", "<undefined>");

    JSAgentWatchData data;
    data.exp = expression.toUtf8();
    data.name = data.exp;
    data.hasChildren = false;
    data.value = value.toString().toUtf8();
    data.objectId = value.objectId();
    if (value.isArray()) {
        data.type = "Array";
        data.value = arrayStr.arg(value.property(QLatin1String("length")).toString()).toUtf8();
        data.hasChildren = true;
    } else if (value.isBool()) {
        data.type = "Bool";
        // data.value = value.toBool() ? "true" : "false";
    } else if (value.isDate()) {
        data.type = "Date";
        data.value = value.toDateTime().toString().toUtf8();
    } else if (value.isError()) {
        data.type = "Error";
    } else if (value.isFunction()) {
        data.type = "Function";
    } else if (value.isUndefined()) {
        data.type = undefinedStr.toUtf8();
    } else if (value.isNumber()) {
        data.type = "Number";
    } else if (value.isRegExp()) {
        data.type = "RegExp";
    } else if (value.isString()) {
        data.type = "String";
    } else if (value.isVariant()) {
        data.type = "Variant";
    } else if (value.isQObject()) {
        const QObject *obj = value.toQObject();
        data.type = "Object";
        data.value += '[';
        data.value += obj->metaObject()->className();
        data.value += ']';
        data.hasChildren = true;
    } else if (value.isObject()) {
        data.type = "Object";
        data.hasChildren = true;
        data.value = "[Object]";
    } else if (value.isNull()) {
        data.type = "<null>";
    } else {
        data.type = "<unknown>";
    }
    return data;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:56,代码来源:qjsdebuggeragent.cpp

示例10: executeCommand

/**
 * Executes the command in the command text box.
 */
void dlgScriptConsole::executeCommand() {
  QString cmd = doc->text(); //txtCommand->toPlainText();
  QScriptValue result = engine->evaluate(cmd);
  
  if( !(result.isUndefined()) && !(result.isNull()) ) {
    lblError->setText(result.toString());
  } else {
    lblError->setText("Command executed successfully.");
  }
}
开发者ID:spthaolt,项目名称:qscite,代码行数:13,代码来源:scriptconsole.cpp

示例11: equals

    bool IniFile::equals(const QScriptValue &other) const
    {
        if(other.isUndefined() || other.isNull())
            return false;

        QObject *object = other.toQObject();
        if(IniFile *otherIniFile = qobject_cast<IniFile*>(object))
            return (otherIniFile == this);

        return false;
    }
开发者ID:niconil,项目名称:actionaz,代码行数:11,代码来源:inifile.cpp

示例12: equals

bool File::equals(const QScriptValue &other) const
{
    if(other.isUndefined() || other.isNull())
        return false;

    QObject *object = other.toQObject();
    if(File *otherFile = qobject_cast<File*>(object))
        return (otherFile == this || &otherFile->mFile == &mFile);

    return false;
}
开发者ID:niconil,项目名称:actionaz,代码行数:11,代码来源:file.cpp

示例13: equals

bool RawData::equals(const QScriptValue &other) const
{
    if(other.isUndefined() || other.isNull())
        return false;

    QObject *object = other.toQObject();
    if(RawData *otherRawData = qobject_cast<RawData*>(object))
        return (otherRawData == this || otherRawData->mByteArray == mByteArray);

    return false;
}
开发者ID:WeDo30,项目名称:actiona,代码行数:11,代码来源:rawdata.cpp

示例14: equals

	bool Size::equals(const QScriptValue &other) const
	{
		if(other.isUndefined() || other.isNull())
			return false;
		
		QObject *object = other.toQObject();
		if(Size *otherSize = qobject_cast<Size*>(object))
			return (otherSize == this || otherSize->mSize == mSize);
			
		return false;
	}
开发者ID:niconil,项目名称:actionaz,代码行数:11,代码来源:size.cpp

示例15: equals

	bool ProcessHandle::equals(const QScriptValue &other) const
	{
		if(other.isUndefined() || other.isNull())
			return false;
		
		QObject *object = other.toQObject();
		if(ProcessHandle *otherProcess = qobject_cast<ProcessHandle*>(object))
			return (otherProcess == this || otherProcess->mProcessId == mProcessId);
			
		return false;
	}
开发者ID:sakazuki,项目名称:actiona,代码行数:11,代码来源:processhandle.cpp


注:本文中的QScriptValue::isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。