Commit 1a6ff5d5 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.ItemLibrary: allow overwriting existing entries

Since the item library becomes more dynamic, when we allow
.metainfo files in designer sub folders of components we need this.

Change-Id: Ib5a5659a0e8e880e109bbb7dca3ae31bf332e451
Reviewed-by: default avatarMarco Bubke <>
parent b45496ea
......@@ -106,7 +106,7 @@ public:
QList<ItemLibraryEntry> entriesForType(const QString &typeName, int majorVersion, int minorVersion) const;
ItemLibraryEntry entry(const QString &name) const;
void addEntry(const ItemLibraryEntry &entry);
void addEntry(const ItemLibraryEntry &entry, bool overwriteDuplicate = false);
bool containsEntry(const ItemLibraryEntry &entry);
void clearEntries();
......@@ -311,10 +311,10 @@ static inline QString keyForEntry(const ItemLibraryEntry &entry)
return + entry.category() + QString::number(entry.majorVersion());
void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry)
void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry, bool overwriteDuplicate)
const QString key = keyForEntry(entry);
if (m_nameToEntryHash.contains(key))
if (!overwriteDuplicate && m_nameToEntryHash.contains(key))
throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__);
m_nameToEntryHash.insert(key, entry);
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