Commit 8371a83d authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.ItemLibrary: load QML source on startup

The QML source is now loaded while dragging, which creates
hickups.

Change-Id: If43e4661881f94d6a6f692981f19a61ac2c0e508
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent d4b4353a
......@@ -70,6 +70,7 @@ public:
QString category() const;
QIcon dragIcon() const;
QString qml() const;
QString qmlSource() const;
QString requiredImport() const;
bool forceImport() const;
......
......@@ -32,6 +32,8 @@
#include <QSharedData>
#include <utils/fileutils.h>
namespace QmlDesigner {
namespace Internal {
......@@ -51,6 +53,7 @@ public:
QIcon dragIcon;
QList<PropertyContainer> properties;
QString qml;
QString qmlSource;
QString requiredImport;
bool forceImport;
};
......@@ -123,6 +126,11 @@ QString ItemLibraryEntry::qml() const
return m_data->qml;
}
QString ItemLibraryEntry::qmlSource() const
{
return m_data->qmlSource;
}
QString ItemLibraryEntry::requiredImport() const
{
return m_data->requiredImport;
......@@ -183,6 +191,7 @@ void ItemLibraryEntry::setIconPath(const QString &iconPath)
void ItemLibraryEntry::setQml(const QString &qml)
{
m_data->qml = qml;
m_data->qmlSource = Utils::FileReader::fetchQrc(qml);
}
void ItemLibraryEntry::setRequiredImport(const QString &requiredImport)
......@@ -217,6 +226,7 @@ QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibrary
stream << itemLibraryEntry.m_data->properties;
stream << itemLibraryEntry.m_data->qml;
stream << itemLibraryEntry.m_data->qmlSource;
return stream;
}
......@@ -236,6 +246,7 @@ QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)
stream >> itemLibraryEntry.m_data->properties;
stream >> itemLibraryEntry.m_data->qml;
stream >> itemLibraryEntry.m_data->qmlSource;
return stream;
}
......@@ -255,6 +266,7 @@ QDebug operator<<(QDebug debug, const ItemLibraryEntry &itemLibraryEntry)
debug << itemLibraryEntry.m_data->properties;
debug << itemLibraryEntry.m_data->qml;
debug << itemLibraryEntry.m_data->qmlSource;
return debug.space();
}
......
......@@ -233,7 +233,7 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryE
QPlainTextEdit textEdit;
textEdit.setPlainText(Utils::FileReader::fetchQrc(itemLibraryEntry.qml()));
textEdit.setPlainText(itemLibraryEntry.qmlSource());
NotIndentingTextEditModifier modifier(&textEdit);
QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, 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