本文整理汇总了C++中QScopedPointer::errors方法的典型用法代码示例。如果您正苦于以下问题:C++ QScopedPointer::errors方法的具体用法?C++ QScopedPointer::errors怎么用?C++ QScopedPointer::errors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScopedPointer
的用法示例。
在下文中一共展示了QScopedPointer::errors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ensureInitialized
void ensureInitialized()
{
if (!onVisibleChanged.isValid()) {
int index = q_ptr->metaObject()->indexOfMethod("implementationVisibileChanged()");
Q_ASSERT(index >= 0);
onVisibleChanged = q_ptr->metaObject()->method(index);
}
if (component.isNull()) {
Config config;
config.beginGroup(QStringLiteral("qml/themes"));
QString themeName = config.value(dialogName, QStringLiteral("default"));
QString themePath = ThemeManager::path(QStringLiteral("qml/") + dialogName, themeName);
if (themePath.isEmpty()) {
qWarning() << "Failed to find theme:" << themeName << "for dialog:" << dialogName;
themePath = ThemeManager::path(QStringLiteral("qml/") + dialogName, QStringLiteral("default"));
if (themePath.isEmpty()) {
qCritical() << "Failed to find default theme for dialog:" << dialogName;
return;
}
}
QString fileName = themePath + QStringLiteral("/main.qml");
component.reset(new QQmlComponent(DeclarativeView::globalEngine(), fileName));
}
if (dialog.isNull()) {
dialog = component->create();
visibleProperty = QMetaProperty();
if (!dialog) {
qCritical() << "Failed to create object for component:" << component->url() << "errors:";
for (QQmlError error : component->errors()) {
qCritical() << error.toString();
}
return;
}
deathConnection = QObject::connect(dialog.data(), &QObject::destroyed, q_ptr, [this] () {
dialog.clear();
visibleProperty = QMetaProperty();
updateVisible();
});
int visibleIndex = dialog->metaObject()->indexOfProperty("visible");
if (visibleIndex < 0) {
qCritical() << "Failed to find \"visible\" property for component:" << component->url();
return;
}
visibleProperty = dialog->metaObject()->property(visibleIndex);
if (!visibleProperty.hasNotifySignal()) {
qCritical() << "Property \"visible\" has no notify signal for component:" << component->url();
} else {
QObject::connect(dialog.data(), visibleProperty.notifySignal(), q_ptr, onVisibleChanged);
}
updateVisible();
}
}