Commit 28b512df authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.ItemLibrary: remove forceEntry



This feature allowed items to show up in the library even if the import
was missing. This feature was error prone and increased the complexity
of creating items a lot. Since we now have an import manager this is not
required anymore.

Change-Id: Ia127077be0b6c82a047cbb8f86ac3ab24e2d82ae
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent c4b1b16e
......@@ -508,9 +508,9 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
NodeMetaInfo metaInfo = model->metaInfo(entry.typeName(), -1, -1);
bool valid = metaInfo.isValid() && metaInfo.majorVersion() == entry.majorVersion();
if ((valid || entry.forceImport())
if (valid
&& (entry.requiredImport().isEmpty()
|| model->hasImport(entryToImport(entry), true, true) || entry.forceImport())) {
|| model->hasImport(entryToImport(entry), true, true))) {
QString itemSectionName = entry.category();
ItemLibrarySectionModel *sectionModel;
ItemLibraryItemModel *itemModel;
......
......@@ -72,7 +72,6 @@ public:
QString qmlPath() const;
QString qmlSource() const;
QString requiredImport() const;
bool forceImport() const;
ItemLibraryEntry(const ItemLibraryEntry &other);
ItemLibraryEntry& operator=(const ItemLibraryEntry &other);
......@@ -91,7 +90,7 @@ public:
void setCategory(const QString &category);
void setQmlPath(const QString &qml);
void setRequiredImport(const QString &requiredImport);
void setForceImport(bool b);
private:
QExplicitlySharedDataPointer<Internal::ItemLibraryEntryData> m_data;
};
......
......@@ -55,7 +55,6 @@ public:
QString qml;
QString qmlSource;
QString requiredImport;
bool forceImport;
};
} // namespace Internal
......@@ -136,11 +135,6 @@ QString ItemLibraryEntry::requiredImport() const
return m_data->requiredImport;
}
bool ItemLibraryEntry::forceImport() const
{
return m_data->forceImport;
}
int ItemLibraryEntry::majorVersion() const
{
return m_data->majorVersion;
......@@ -210,11 +204,6 @@ void ItemLibraryEntry::setRequiredImport(const QString &requiredImport)
m_data->requiredImport = requiredImport;
}
void ItemLibraryEntry::setForceImport(bool b)
{
m_data->forceImport = b;
}
void ItemLibraryEntry::addProperty(PropertyName &name, QString &type, QVariant &value)
{
Property property;
......@@ -233,7 +222,6 @@ QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibrary
stream << itemLibraryEntry.category();
stream << itemLibraryEntry.dragIcon();
stream << itemLibraryEntry.requiredImport();
stream << itemLibraryEntry.forceImport();
stream << itemLibraryEntry.m_data->properties;
stream << itemLibraryEntry.m_data->qml;
......@@ -253,7 +241,6 @@ QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)
stream >> itemLibraryEntry.m_data->category;
stream >> itemLibraryEntry.m_data->dragIcon;
stream >> itemLibraryEntry.m_data->requiredImport;
stream >> itemLibraryEntry.m_data->forceImport;
stream >> itemLibraryEntry.m_data->properties;
stream >> itemLibraryEntry.m_data->qml;
......@@ -273,7 +260,6 @@ QDebug operator<<(QDebug debug, const ItemLibraryEntry &itemLibraryEntry)
debug << itemLibraryEntry.m_data->category;
debug << itemLibraryEntry.m_data->dragIcon;
debug << itemLibraryEntry.m_data->requiredImport;
debug << itemLibraryEntry.m_data->forceImport;
debug << itemLibraryEntry.m_data->properties;
debug << itemLibraryEntry.m_data->qml;
......
......@@ -164,7 +164,6 @@ MetaInfoReader::ParserSate MetaInfoReader::readTypeElement(const QString &name)
{
if (name == QLatin1String(ItemLibraryEntryElementName)) {
m_currentEntry = ItemLibraryEntry();
m_currentEntry.setForceImport(false);
m_currentEntry.setType(m_currentClassName, -1, -1);
m_currentEntry.setIcon(QIcon(m_currentIcon));
return ParsingItemLibrary;
......@@ -227,8 +226,6 @@ void MetaInfoReader::readItemLibraryEntryProperty(const QString &name, const QVa
setVersion(value.toString());
} else if (name == QLatin1String("requiredImport")) {
m_currentEntry.setRequiredImport(value.toString());
} else if (name == QLatin1String("forceImport")) {
m_currentEntry.setForceImport(value.toBool());
} else {
addError(tr("Unknown property for ItemLibraryEntry %1").arg(name), currentSourceLocation());
setParserState(Error);
......
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