Commit c7ba291c authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Alessandro Portale

QmlDesigner.ItemLibrary: Adding logging category

This makes it possible to debug the .metainfo files in
a release build/package.

Change-Id: Iceae98b0e00b9d4deba0ae3f31b1f55fca2c5cf2
Reviewed-by: Alessandro Portale's avatarAlessandro Portale <alessandro.portale@qt.io>
parent dd2d17ed
......@@ -36,11 +36,14 @@
#include <QVariant>
#include <QMetaProperty>
#include <QLoggingCategory>
#include <QMimeData>
#include <QPainter>
#include <QPen>
#include <qdebug.h>
static Q_LOGGING_CATEGORY(itemlibraryPopulate, "itemlibrary.populate")
static bool inline registerItemLibrarySortedModel() {
qmlRegisterType<QmlDesigner::ItemLibrarySectionModel>();
return true;
......@@ -150,23 +153,35 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
if (import.isLibraryImport())
imports << import.url() + QLatin1Char(' ') + import.version();
qCInfo(itemlibraryPopulate) << Q_FUNC_INFO;
foreach (ItemLibraryEntry entry, itemLibraryInfo->entries()) {
NodeMetaInfo metaInfo = model->metaInfo(entry.typeName());
bool valid = metaInfo.isValid() && metaInfo.majorVersion() == entry.majorVersion();
bool isItem = valid && metaInfo.isSubclassOf("QtQuick.Item");
qCInfo(itemlibraryPopulate) << entry.typeName() << entry.majorVersion() << entry.minorVersion();
NodeMetaInfo metaInfo = model->metaInfo(entry.typeName());
qCInfo(itemlibraryPopulate) << "valid: " << metaInfo.isValid() << metaInfo.majorVersion() << metaInfo.minorVersion();
if (!isItem && valid) {
qDebug() << Q_FUNC_INFO;
qDebug() << metaInfo.typeName() << "is not a QtQuick.Item";
qDebug() << Utils::transform(metaInfo.superClasses(), &NodeMetaInfo::typeName);
}
bool valid = metaInfo.isValid() && metaInfo.majorVersion() == entry.majorVersion();
bool isItem = valid && metaInfo.isSubclassOf("QtQuick.Item");
qCInfo(itemlibraryPopulate) << "isItem: " << isItem;
qCInfo(itemlibraryPopulate) << "required import: " << entry.requiredImport() << entryToImport(entry).toImportString();
if (!isItem && valid) {
qDebug() << Q_FUNC_INFO;
qDebug() << metaInfo.typeName() << "is not a QtQuick.Item";
qDebug() << Utils::transform(metaInfo.superClasses(), &NodeMetaInfo::typeName);
}
if (valid
&& isItem //We can change if the navigator does support pure QObjects
&& (entry.requiredImport().isEmpty()
|| model->hasImport(entryToImport(entry), true, true))) {
if (valid
&& isItem //We can change if the navigator does support pure QObjects
&& (entry.requiredImport().isEmpty()
|| model->hasImport(entryToImport(entry), true, true))) {
QString itemSectionName = entry.category();
qCInfo(itemlibraryPopulate) << "Adding:" << entry.typeName() << "to:" << entry.category();
ItemLibrarySection *sectionModel = sectionByName(itemSectionName);
if (sectionModel == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment