Commit 70ffe0c2 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.metaInfo: extending itemlibrary info

I added forceImport.
parent b9ff6032
......@@ -72,6 +72,7 @@ public:
QIcon dragIcon() const;
QString qml() const;
QString requiredImport() const;
bool forceImport() const;
ItemLibraryEntry(const ItemLibraryEntry &other);
ItemLibraryEntry& operator=(const ItemLibraryEntry &other);
......@@ -90,6 +91,7 @@ public:
void setCategory(const QString &category);
void setQml(const QString &qml);
void setRequiredImport(const QString &requiredImport);
void setForceImport(bool b);
private:
QExplicitlySharedDataPointer<Internal::ItemLibraryEntryData> m_data;
};
......
......@@ -55,6 +55,7 @@ public:
QList<PropertyContainer> properties;
QString qml;
QString requiredImport;
bool forceImport;
};
class ItemLibraryInfoPrivate
......@@ -138,6 +139,11 @@ QString ItemLibraryEntry::requiredImport() const
return m_data->requiredImport;
}
bool ItemLibraryEntry::forceImport() const
{
return m_data->forceImport;
}
int ItemLibraryEntry::majorVersion() const
{
return m_data->majorVersion;
......@@ -195,6 +201,11 @@ void ItemLibraryEntry::setRequiredImport(const QString &requiredImport)
m_data->requiredImport = requiredImport;
}
void ItemLibraryEntry::setForceImport(bool b)
{
m_data->forceImport = b;
}
void ItemLibraryEntry::addProperty(QString &name, QString &type, QString &value)
{
Property property;
......@@ -213,6 +224,7 @@ QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibrary
stream << itemLibraryEntry.category();
stream << itemLibraryEntry.dragIcon();
stream << itemLibraryEntry.requiredImport();
stream << itemLibraryEntry.forceImport();
stream << itemLibraryEntry.m_data->properties;
......@@ -230,6 +242,7 @@ 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;
......
......@@ -150,6 +150,16 @@ void MetaInfoParser::handleNodeItemLibraryEntryElement(QXmlStreamReader &reader,
if (!requiredImport.isEmpty())
entry.setRequiredImport(requiredImport);
if (reader.attributes().hasAttribute("forceImport")) {
QString forceImport = reader.attributes().value("forceImport").toString();
if (forceImport == QLatin1String("true") || forceImport == QLatin1String("True"))
entry.setForceImport(true);
else
entry.setForceImport(false);
} else {
entry.setForceImport(false);
}
while (!reader.atEnd() && !(reader.isEndElement() && reader.name() == "itemlibraryentry")) {
reader.readNext();
handleItemLibraryEntryPropertyElement(reader, 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