aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörg Schummer <ext-jorg.2.schummer@nokia.com>2010-03-04 13:30:36 +0200
committercon <qtc-committer@nokia.com>2010-03-05 16:50:30 +0100
commitae41d14e710ab4aae71b19ed41df2dac962a36a9 (patch)
tree6f21f334c309f2e941f979a8fafc47d47b246ee9
parent796f76e80c775ba2647bfe31de095d32a6cbf481 (diff)
QmlDesigner.ItemLibrary: fixed: do not display non-visual components
Task-number: BAUHAUS-433 Reviewed-by: kkoehne (cherry picked from commit 0943177d86f99f8f828e66b324d2bf70dc504089)
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp84
1 files changed, 44 insertions, 40 deletions
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp
index c15aacec83..a1fbe6b93d 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp
@@ -435,49 +435,53 @@ void ItemLibraryModel::updateVisibility()
QList<ItemLibraryInfo> ItemLibraryModel::itemLibraryRepresentations(const QString &type)
{
+ QList<ItemLibraryInfo> itemLibraryRepresentationList;
NodeMetaInfo nodeInfo = m_metaInfo->nodeMetaInfo(type);
- QList<ItemLibraryInfo> itemLibraryRepresentationList = m_metaInfo->itemLibraryRepresentations(nodeInfo);
-
- QImage dragImage(64, 64, QImage::Format_RGB32); // TODO: draw item drag icon
- dragImage.fill(0xffffffff);
- QPainter p(&dragImage);
- QPen pen(Qt::gray);
- pen.setWidth(2);
- p.setPen(pen);
- p.drawRect(1, 1, dragImage.width() - 2, dragImage.height() - 2);
- QPixmap dragPixmap(QPixmap::fromImage(dragImage));
-
- if (!m_metaInfo->hasNodeMetaInfo(type))
- qWarning() << "ItemLibrary: type not declared: " << type;
-
- static QIcon defaultIcon(QLatin1String(":/ItemLibrary/images/item-default-icon.png"));
-
- if (itemLibraryRepresentationList.isEmpty() || !m_metaInfo->hasNodeMetaInfo(type)) {
- QIcon icon = nodeInfo.icon();
- if (icon.isNull())
- icon = defaultIcon;
-
- ItemLibraryInfo itemLibraryInfo;
- itemLibraryInfo.setName(type);
- itemLibraryInfo.setTypeName(nodeInfo.typeName());
- itemLibraryInfo.setCategory(nodeInfo.category());
- itemLibraryInfo.setIcon(icon);
- itemLibraryInfo.setDragIcon(dragPixmap);
- itemLibraryInfo.setMajorVersion(nodeInfo.majorVersion());
- itemLibraryInfo.setMinorVersion(nodeInfo.minorVersion());
- itemLibraryRepresentationList.append(itemLibraryInfo);
- }
- else {
- foreach (ItemLibraryInfo itemLibraryRepresentation, itemLibraryRepresentationList) {
- QIcon icon = itemLibraryRepresentation.icon();
- if (itemLibraryRepresentation.icon().isNull())
- itemLibraryRepresentation.setIcon(defaultIcon);
- if (itemLibraryRepresentation.dragIcon().isNull())
- itemLibraryRepresentation.setDragIcon(dragPixmap);
+ if (nodeInfo.isQmlGraphicsItem()) {
+ itemLibraryRepresentationList = m_metaInfo->itemLibraryRepresentations(nodeInfo);
+
+ QImage dragImage(64, 64, QImage::Format_RGB32); // TODO: draw item drag icon
+ dragImage.fill(0xffffffff);
+ QPainter p(&dragImage);
+ QPen pen(Qt::gray);
+ pen.setWidth(2);
+ p.setPen(pen);
+ p.drawRect(1, 1, dragImage.width() - 2, dragImage.height() - 2);
+ QPixmap dragPixmap(QPixmap::fromImage(dragImage));
+
+ if (!m_metaInfo->hasNodeMetaInfo(type))
+ qWarning() << "ItemLibrary: type not declared: " << type;
+
+ static QIcon defaultIcon(QLatin1String(":/ItemLibrary/images/item-default-icon.png"));
+
+ if (itemLibraryRepresentationList.isEmpty() || !m_metaInfo->hasNodeMetaInfo(type)) {
+ QIcon icon = nodeInfo.icon();
+ if (icon.isNull())
+ icon = defaultIcon;
+
+ ItemLibraryInfo itemLibraryInfo;
+ itemLibraryInfo.setName(type);
+ itemLibraryInfo.setTypeName(nodeInfo.typeName());
+ itemLibraryInfo.setCategory(nodeInfo.category());
+ itemLibraryInfo.setIcon(icon);
+ itemLibraryInfo.setDragIcon(dragPixmap);
+ itemLibraryInfo.setMajorVersion(nodeInfo.majorVersion());
+ itemLibraryInfo.setMinorVersion(nodeInfo.minorVersion());
+ itemLibraryRepresentationList.append(itemLibraryInfo);
+ }
+ else {
+ foreach (ItemLibraryInfo itemLibraryRepresentation, itemLibraryRepresentationList) {
+ QIcon icon = itemLibraryRepresentation.icon();
+ if (itemLibraryRepresentation.icon().isNull())
+ itemLibraryRepresentation.setIcon(defaultIcon);
+
+ if (itemLibraryRepresentation.dragIcon().isNull())
+ itemLibraryRepresentation.setDragIcon(dragPixmap);
- if (itemLibraryRepresentation.category().isEmpty())
- itemLibraryRepresentation.setCategory(nodeInfo.category());
+ if (itemLibraryRepresentation.category().isEmpty())
+ itemLibraryRepresentation.setCategory(nodeInfo.category());
+ }
}
}