本文整理汇总了C++中QScopedPointer::geometry方法的典型用法代码示例。如果您正苦于以下问题:C++ QScopedPointer::geometry方法的具体用法?C++ QScopedPointer::geometry怎么用?C++ QScopedPointer::geometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScopedPointer
的用法示例。
在下文中一共展示了QScopedPointer::geometry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: request
/*!
* \internal
*/
QGeometry *MeshLoaderFunctor::operator()()
{
if (m_sourcePath.isEmpty()) {
qCWarning(Render::Jobs) << Q_FUNC_INFO << "Mesh is empty, nothing to load";
return nullptr;
}
QStringList ext;
if (!Qt3DCore::QDownloadHelperService::isLocal(m_sourcePath)) {
if (m_sourceData.isEmpty()) {
if (m_mesh) {
// Output a warning in the case a user is calling the functor directly
// in the frontend
if (m_nodeManagers == nullptr || m_downloaderService == nullptr) {
qWarning() << "Mesh source points to a remote URL. Remotes meshes can only be loaded if the geometry is processed by the Qt3DRender backend";
return nullptr;
}
Qt3DCore::QDownloadRequestPtr request(new MeshDownloadRequest(m_mesh, m_sourcePath, m_nodeManagers));
m_downloaderService->submitRequest(request);
}
return nullptr;
}
QMimeDatabase db;
QMimeType mtype = db.mimeTypeForData(m_sourceData);
if (mtype.isValid()) {
ext = mtype.suffixes();
}
QFileInfo finfo(m_sourcePath.path());
ext << finfo.suffix();
ext.removeAll(QLatin1String(""));
if (!ext.contains(QLatin1String("obj")))
ext << QLatin1String("obj");
} else {
QString filePath = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath);
QFileInfo finfo(filePath);
if (finfo.suffix().isEmpty())
ext << QLatin1String("obj");
else
ext << finfo.suffix();
}
QScopedPointer<QGeometryLoaderInterface> loader;
for (const QString &e: qAsConst(ext)) {
loader.reset(qLoadPlugin<QGeometryLoaderInterface, QGeometryLoaderFactory>(geometryLoader(), e));
if (loader)
break;
}
if (!loader) {
qCWarning(Render::Jobs, "unsupported format encountered (%s)", qPrintable(ext.join(QLatin1String(", "))));
return nullptr;
}
if (m_sourceData.isEmpty()) {
QString filePath = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath);
QFile file(filePath);
if (!file.open(QIODevice::ReadOnly)) {
qCDebug(Render::Jobs) << "Could not open file" << filePath << "for reading";
return nullptr;
}
if (loader->load(&file, m_meshName))
return loader->geometry();
qCWarning(Render::Jobs) << Q_FUNC_INFO << "Mesh loading failure for:" << filePath;
} else {
QT_PREPEND_NAMESPACE(QBuffer) buffer(&m_sourceData);
if (!buffer.open(QIODevice::ReadOnly)) {
return nullptr;
}
if (loader->load(&buffer, m_meshName))
return loader->geometry();
qCWarning(Render::Jobs) << Q_FUNC_INFO << "Mesh loading failure for:" << m_sourcePath;
}
return nullptr;
}