本文整理汇总了C++中qmlEngine函数的典型用法代码示例。如果您正苦于以下问题:C++ qmlEngine函数的具体用法?C++ qmlEngine怎么用?C++ qmlEngine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qmlEngine函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Q_Q
void QDeclarativeLoaderPrivate::_q_sourceLoaded()
{
Q_Q(QDeclarativeLoader);
if (component) {
if (!component->errors().isEmpty()) {
QDeclarativeEnginePrivate::warning(qmlEngine(q), component->errors());
emit q->sourceChanged();
emit q->statusChanged();
emit q->progressChanged();
return;
}
QDeclarativeContext *creationContext = component->creationContext();
if (!creationContext) creationContext = qmlContext(q);
QDeclarativeContext *ctxt = new QDeclarativeContext(creationContext);
ctxt->setContextObject(q);
QDeclarativeGuard<QDeclarativeComponent> c = component;
QObject *obj = component->beginCreate(ctxt);
if (component != c) {
// component->create could trigger a change in source that causes
// component to be set to something else. In that case we just
// need to cleanup.
if (c)
c->completeCreate();
delete obj;
delete ctxt;
return;
}
if (obj) {
item = qobject_cast<QGraphicsObject *>(obj);
if (item) {
QDeclarative_setParent_noEvent(ctxt, obj);
QDeclarative_setParent_noEvent(item, q);
item->setParentItem(q);
// item->setFocus(true);
initResize();
} else {
qmlInfo(q) << QDeclarativeLoader::tr("Loader does not support loading non-visual elements.");
delete obj;
delete ctxt;
}
} else {
if (!component->errors().isEmpty())
QDeclarativeEnginePrivate::warning(qmlEngine(q), component->errors());
delete obj;
delete ctxt;
source = QUrl();
}
component->completeCreate();
emit q->sourceChanged();
emit q->statusChanged();
emit q->progressChanged();
emit q->itemChanged();
emit q->loaded();
}
}
开发者ID:wpbest,项目名称:copperspice,代码行数:58,代码来源:qdeclarativeloader.cpp
示例2: qmlEngine
void QQuickSprite::startImageLoading()
{
m_pix.clear(this);
if (!m_source.isEmpty()) {
QQmlEngine *e = qmlEngine(this);
if (!e) { //If not created in QML, you must set the QObject parent to the QML element so this can work
e = qmlEngine(parent());
if (!e)
qWarning() << "QQuickSprite: Cannot find QQmlEngine - this class is only for use in QML and may not work";
}
m_pix.load(e, m_source);
}
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:13,代码来源:qquicksprite.cpp
示例3: qmlEngine
QDeclarativeInfo::~QDeclarativeInfo()
{
if (0 == --d->ref) {
QList<QDeclarativeError> errors = d->errors;
QDeclarativeEngine *engine = 0;
if (!d->buffer.isEmpty()) {
QDeclarativeError error;
QObject *object = const_cast<QObject *>(d->object);
if (object) {
engine = qmlEngine(d->object);
QString typeName;
QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
if (type) {
typeName = QLatin1String(type->qmlTypeName());
int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
if (lastSlash != -1)
typeName = typeName.mid(lastSlash+1);
} else {
typeName = QString::fromUtf8(object->metaObject()->className());
int marker = typeName.indexOf(QLatin1String("_QMLTYPE_"));
if (marker != -1)
typeName = typeName.left(marker);
marker = typeName.indexOf(QLatin1String("_QML_"));
if (marker != -1) {
typeName = typeName.left(marker) + "*";
type = QDeclarativeMetaType::qmlType(QMetaType::type(typeName.toLatin1()));
if (type) {
typeName = QLatin1String(type->qmlTypeName());
int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
if (lastSlash != -1)
typeName = typeName.mid(lastSlash+1);
}
}
}
d->buffer.prepend(QLatin1String("QML ") + typeName + QLatin1String(": "));
QDeclarativeData *ddata = QDeclarativeData::get(object, false);
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) {
error.setUrl(ddata->outerContext->url);
error.setLine(ddata->lineNumber);
error.setColumn(ddata->columnNumber);
}
}
error.setDescription(d->buffer);
errors.prepend(error);
}
QDeclarativeEnginePrivate::warning(engine, errors);
delete d;
}
}
开发者ID:yinyunqiao,项目名称:qtdeclarative,代码行数:60,代码来源:qdeclarativeinfo.cpp
示例4: QPointF
QQuickItem *GlobalFunctions::itemAt(QQuickItem* parent, int x, int y, QJSValue matcher)
{
if (!parent) return nullptr;
QList<QQuickItem *> children = QQuickItemPrivate::get(parent)->paintOrderChildItems();
for (int i = children.count() - 1; i >= 0; --i) {
QQuickItem *child = children.at(i);
// Map coordinates to the child element's coordinate space
QPointF point = parent->mapToItem(child, QPointF(x, y));
if (child->isVisible() && point.x() >= 0
&& child->width() >= point.x()
&& point.y() >= 0
&& child->height() >= point.y()) {
if (!matcher.isCallable()) return child;
QQmlEngine* engine = qmlEngine(child);
if (!engine) return child;
QJSValue newObj = engine->newQObject(child);
if (matcher.call(QJSValueList() << newObj).toBool()) {
return child;
}
}
}
return nullptr;
}
开发者ID:dumpster-of-things,项目名称:unity8,代码行数:27,代码来源:globalfunctions.cpp
示例5: Q_Q
void QQuickLoaderPrivate::incubatorStateChanged(QQmlIncubator::Status status)
{
Q_Q(QQuickLoader);
if (status == QQmlIncubator::Loading || status == QQmlIncubator::Null)
return;
if (status == QQmlIncubator::Ready) {
object = incubator->object();
item = qmlobject_cast<QQuickItem*>(object);
emit q->itemChanged();
initResize();
incubator->clear();
} else if (status == QQmlIncubator::Error) {
if (!incubator->errors().isEmpty())
QQmlEnginePrivate::warning(qmlEngine(q), incubator->errors());
delete itemContext;
itemContext = 0;
delete incubator->object();
source = QUrl();
emit q->itemChanged();
}
if (loadingFromSource)
emit q->sourceChanged();
else
emit q->sourceComponentChanged();
emit q->statusChanged();
emit q->progressChanged();
if (status == QQmlIncubator::Ready)
emit q->loaded();
disposeInitialPropertyValues(); // cleanup
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:31,代码来源:qquickloader.cpp
示例6: qmlEngine
void Quick3DBuffer::initEngines()
{
if (m_engine == Q_NULLPTR) {
m_engine = qmlEngine(parent());
m_v4engine = QQmlEnginePrivate::getV4Engine(m_engine);
}
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:7,代码来源:quick3dbuffer.cpp
示例7: Q_D
void QDeclarativeFontLoader::setSource(const QUrl &url)
{
Q_D(QDeclarativeFontLoader);
if (url == d->url)
return;
d->url = qmlContext(this)->resolvedUrl(url);
d->status = Loading;
emit statusChanged();
emit sourceChanged();
#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(d->url);
if (!lf.isEmpty()) {
int id = QFontDatabase::addApplicationFont(lf);
if (id != -1) {
d->name = QFontDatabase::applicationFontFamilies(id).at(0);
emit nameChanged();
d->status = QDeclarativeFontLoader::Ready;
} else {
d->status = QDeclarativeFontLoader::Error;
qmlInfo(this) << "Cannot load font: \"" << url.toString() << "\"";
}
emit statusChanged();
} else
#endif
{
QNetworkRequest req(d->url);
req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
d->reply = qmlEngine(this)->networkAccessManager()->get(req);
QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(replyFinished()));
}
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:32,代码来源:qdeclarativefontloader.cpp
示例8: Q_D
void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledImage& sci)
{
Q_D(QDeclarativeBorderImage);
if (!sci.isValid()) {
d->status = Error;
emit statusChanged(d->status);
} else {
QDeclarativeScaleGrid *sg = border();
sg->setTop(sci.gridTop());
sg->setBottom(sci.gridBottom());
sg->setLeft(sci.gridLeft());
sg->setRight(sci.gridRight());
d->horizontalTileMode = sci.horizontalTileRule();
d->verticalTileMode = sci.verticalTileRule();
d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl()));
QDeclarativePixmap::Options options;
if (d->async)
options |= QDeclarativePixmap::Asynchronous;
if (d->cache)
options |= QDeclarativePixmap::Cache;
d->pix.clear(this);
d->pix.load(qmlEngine(this), d->sciurl, options);
if (d->pix.isLoading()) {
static int thisRequestProgress = -1;
static int thisRequestFinished = -1;
if (thisRequestProgress == -1) {
thisRequestProgress =
QDeclarativeBorderImage::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
thisRequestFinished =
QDeclarativeBorderImage::staticMetaObject.indexOfSlot("requestFinished()");
}
d->pix.connectFinished(this, thisRequestFinished);
d->pix.connectDownloadProgress(this, thisRequestProgress);
} else {
QSize impsize = d->pix.implicitSize();
setImplicitWidth(impsize.width());
setImplicitHeight(impsize.height());
if (d->pix.isReady()) {
d->status = Ready;
} else {
d->status = Error;
qmlInfo(this) << d->pix.error();
}
d->progress = 1.0;
emit statusChanged(d->status);
emit progressChanged(1.0);
update();
}
}
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:59,代码来源:qdeclarativeborderimage.cpp
示例9: Q_Q
void QQuickWebEngineViewPrivate::didRunJavaScript(quint64 requestId, const QVariant &result)
{
Q_Q(QQuickWebEngineView);
QJSValue callback = m_callbacks.take(requestId);
QJSValueList args;
args.append(qmlEngine(q)->toScriptValue(result));
callback.call(args);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:8,代码来源:qquickwebengineview.cpp
示例10: EDEBUG
void QmlCppEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result)
{
EDEBUG("MASTER REMOTE SETUP FINISHED");
DebuggerEngine::notifyEngineRemoteSetupFinished(result);
cppEngine()->notifyEngineRemoteSetupFinished(result);
qmlEngine()->notifyEngineRemoteSetupFinished(result);
}
开发者ID:acacid,项目名称:qt-creator,代码行数:8,代码来源:qmlcppengine.cpp
示例11: EDEBUG
void QmlCppEngine::notifyEngineRemoteSetupFailed(const QString &message)
{
EDEBUG("MASTER REMOTE SETUP FAILED");
DebuggerEngine::notifyEngineRemoteSetupFailed(message);
cppEngine()->notifyEngineRemoteSetupFailed(message);
qmlEngine()->notifyEngineRemoteSetupFailed(message);
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:8,代码来源:qmlcppengine.cpp
示例12: qmlEngine
// get all entries (this is costly call)
QJSValue ValueModel::getList() const
{
QJSValue array = qmlEngine(this)->newArray(m_data.count());
for(int i=0; i<m_data.count(); i++) {
array.setProperty(i, m_data.at(i));
}
return array;
}
开发者ID:4lenz1,项目名称:qmlbook,代码行数:9,代码来源:valuemodel.cpp
示例13: qmlEngine
void OpdsBookModel::load(const QUrl &source)
{
QNetworkAccessManager *manager = qmlEngine(QObject::parent())->networkAccessManager();
QNetworkRequest request(source);
QNetworkReply *reply = manager->get(request);
connect(reply, &QNetworkReply::finished, this, &OpdsBookModel::onReplyFinished);
}
开发者ID:euroelessar,项目名称:cutereader,代码行数:8,代码来源:opdsbookmodel.cpp
示例14: Q_D
void QDeclarativeAnimatedImage::setSource(const QUrl &url)
{
Q_D(QDeclarativeAnimatedImage);
if (url == d->url)
return;
delete d->_movie;
d->_movie = 0;
if (d->reply) {
d->reply->deleteLater();
d->reply = 0;
}
d->url = url;
if (url.isEmpty()) {
delete d->_movie;
d->status = Null;
} else {
#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url);
if (!lf.isEmpty()) {
//### should be unified with movieRequestFinished
d->_movie = new QMovie(lf);
if (!d->_movie->isValid()){
qmlInfo(this) << "Error Reading Animated Image File " << d->url.toString();
delete d->_movie;
d->_movie = 0;
return;
}
connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)),
this, SLOT(playingStatusChanged()));
connect(d->_movie, SIGNAL(frameChanged(int)),
this, SLOT(movieUpdate()));
d->_movie->setCacheMode(QMovie::CacheAll);
if(d->playing)
d->_movie->start();
else
d->_movie->jumpToFrame(0);
if(d->paused)
d->_movie->setPaused(true);
d->setPixmap(d->_movie->currentPixmap());
d->status = Ready;
d->progress = 1.0;
emit statusChanged(d->status);
emit sourceChanged(d->url);
emit progressChanged(d->progress);
return;
}
#endif
d->status = Loading;
QNetworkRequest req(d->url);
req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
d->reply = qmlEngine(this)->networkAccessManager()->get(req);
QObject::connect(d->reply, SIGNAL(finished()),
this, SLOT(movieRequestFinished()));
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:58,代码来源:qdeclarativeanimatedimage.cpp
示例15: CompetitorDocument
QObject *CompetitorsPlugin::createCompetitorDocument(QObject *parent)
{
CompetitorDocument *ret = new CompetitorDocument(parent);
if(!parent) {
qfWarning() << "Parent is NULL, created class will have QQmlEngine::JavaScriptOwnership.";
qmlEngine()->setObjectOwnership(ret, QQmlEngine::JavaScriptOwnership);
}
return ret;
}
开发者ID:mezkov,项目名称:quickbox,代码行数:9,代码来源:competitorsplugin.cpp
示例16: QQmlComponent
QQuickItem * DataSetView::createRowNumber(int row)
{
//std::cout << "createRowNumber("<<row<<") called!\n" << std::flush;
if(_rowNumberDelegate == NULL)
{
_rowNumberDelegate = new QQmlComponent(qmlEngine(this));
_rowNumberDelegate->setData("import QtQuick 2.10\nItem {\n"
"property alias text: tekst.text\n"
"Rectangle { color: \"lightGrey\"; anchors.fill: parent }\n"
"Text { id: tekst; anchors.centerIn: parent }\n"
"}", QUrl());
}
QQuickItem * rowNumber = NULL;
if(_rowNumberItems.count(row) == 0 || _rowNumberItems[row] == NULL)
{
if(_rowNumberStorage.size() > 0)
{
#ifdef DEBUG_VIEWPORT
std::cout << "createRowNumber("<<row<<") from storage!\n" << std::flush;
#endif
rowNumber = _rowNumberStorage.top();
_rowNumberStorage.pop();
}
else
{
#ifdef DEBUG_VIEWPORT
std::cout << "createRowNumber("<<row<<") ex nihilo!\n" << std::flush;
#endif
rowNumber = qobject_cast<QQuickItem*>(_rowNumberDelegate->create());
rowNumber->setParent(this);
rowNumber->setParentItem(this);
}
rowNumber->setProperty("z", 10);
rowNumber->setProperty("text", QString::fromStdString(std::to_string(row + 1))); //Nobody wants zero-based rows...
rowNumber->setY(_dataRowsMaxHeight * (1 + row));
rowNumber->setZ(-3);
rowNumber->setHeight(_dataRowsMaxHeight);
rowNumber->setWidth(_rowNumberMaxWidth);
rowNumber->setVisible(true);
_rowNumberItems[row] = rowNumber;
}
else
rowNumber = _rowNumberItems[row];
rowNumber->setX(_viewportX);
return _rowNumberItems[row];
}
开发者ID:akashrajkn,项目名称:jasp-desktop,代码行数:57,代码来源:datasetview.cpp
示例17: qmlEngine
void QQmlVMEMetaObject::allocateVarPropertiesArray()
{
QQmlEngine *qml = qmlEngine(object);
assert(qml);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(qml->handle());
QV4::Scope scope(v4);
varProperties = QV4::ScopedValue(scope, v4->newArrayObject(metaData->varPropertyCount));
varPropertiesInitialized = true;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:9,代码来源:qqmlvmemetaobject.cpp
示例18: Q_D
void QQuickImageBase::load()
{
Q_D(QQuickImageBase);
if (d->url.isEmpty()) {
d->pix.clear(this);
if (d->progress != 0.0) {
d->progress = 0.0;
emit progressChanged(d->progress);
}
pixmapChange();
d->status = Null;
emit statusChanged(d->status);
if (sourceSize() != d->oldSourceSize) {
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
update();
} else {
QQuickPixmap::Options options;
if (d->async)
options |= QQuickPixmap::Asynchronous;
if (d->cache)
options |= QQuickPixmap::Cache;
d->pix.clear(this);
d->pix.load(qmlEngine(this), d->url, d->sourcesize, options);
if (d->pix.isLoading()) {
if (d->progress != 0.0) {
d->progress = 0.0;
emit progressChanged(d->progress);
}
if (d->status != Loading) {
d->status = Loading;
emit statusChanged(d->status);
}
static int thisRequestProgress = -1;
static int thisRequestFinished = -1;
if (thisRequestProgress == -1) {
thisRequestProgress =
QQuickImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
thisRequestFinished =
QQuickImageBase::staticMetaObject.indexOfSlot("requestFinished()");
}
d->pix.connectFinished(this, thisRequestFinished);
d->pix.connectDownloadProgress(this, thisRequestProgress);
update(); //pixmap may have invalidated texture, updatePaintNode needs to be called before the next repaint
} else {
requestFinished();
}
}
}
开发者ID:SamuelNevala,项目名称:qtdeclarative,代码行数:56,代码来源:qquickimagebase.cpp
示例19: restore
QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyName,
const QVariant &value)
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
property(target, propertyName, qmlEngine(target)), toValue(value),
fromBinding(0), event(0),
specifiedObject(target), specifiedProperty(propertyName)
{
if (property.isValid())
fromValue = property.read();
}
开发者ID:husninazer,项目名称:qt,代码行数:10,代码来源:qdeclarativestate.cpp
示例20: callerLine
int callerLine(int frameIndex = 0) const
{
QQmlEngine *engine = qmlEngine(this);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle());
QVector<QV4::StackFrame> stack = v4->stackTrace(frameIndex + 2);
if (stack.size() > frameIndex + 1)
return stack.at(frameIndex + 1).line;
return -1;
}
开发者ID:xjohncz,项目名称:qt5,代码行数:10,代码来源:main.cpp
注:本文中的qmlEngine函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论