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

QmlDesigner.itemLibrary: add requiredImport

parent 3f283dbc
......@@ -68,6 +68,7 @@ public:
QString category() const;
QIcon dragIcon() const;
QString qml() const;
QString requiredImport() const;
ItemLibraryEntry(const ItemLibraryEntry &other);
ItemLibraryEntry& operator=(const ItemLibraryEntry &other);
......@@ -85,6 +86,7 @@ public:
void setIcon(const QIcon &icon);
void setCategory(const QString &category);
void setQml(const QString &qml);
void setRequiredImport(const QString &requiredImport);
private:
QExplicitlySharedDataPointer<Internal::ItemLibraryEntryData> m_data;
};
......
......@@ -51,6 +51,7 @@ public:
QIcon dragIcon;
QList<PropertyContainer> properties;
QString qml;
QString requiredImport;
};
class ItemLibraryInfoPrivate
......@@ -129,6 +130,11 @@ QString ItemLibraryEntry::qml() const
return m_data->qml;
}
QString ItemLibraryEntry::requiredImport() const
{
return m_data->requiredImport;
}
int ItemLibraryEntry::majorVersion() const
{
return m_data->majorVersion;
......@@ -181,6 +187,11 @@ void ItemLibraryEntry::setQml(const QString &qml)
m_data->qml = qml;
}
void ItemLibraryEntry::setRequiredImport(const QString &requiredImport)
{
m_data->requiredImport = requiredImport;
}
void ItemLibraryEntry::addProperty(QString &name, QString &type, QString &value)
{
Property property;
......@@ -198,6 +209,8 @@ QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibrary
stream << itemLibraryEntry.iconPath();
stream << itemLibraryEntry.category();
stream << itemLibraryEntry.dragIcon();
stream << itemLibraryEntry.requiredImport();
stream << itemLibraryEntry.m_data->properties;
return stream;
......@@ -213,6 +226,8 @@ QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)
stream >> itemLibraryEntry.m_data->iconPath;
stream >> itemLibraryEntry.m_data->category;
stream >> itemLibraryEntry.m_data->dragIcon;
stream >> itemLibraryEntry.m_data->requiredImport;
stream >> itemLibraryEntry.m_data->properties;
return stream;
......
......@@ -143,6 +143,12 @@ void MetaInfoParser::handleNodeItemLibraryEntryElement(QXmlStreamReader &reader,
if (!category.isEmpty())
entry.setCategory(category);
QString requiredImport = reader.attributes().value("requiredImport").toString();
if (!requiredImport.isEmpty())
entry.setRequiredImport(requiredImport);
qDebug() << entry.requiredImport();
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