Commit ef2e3914 authored by Tim Jenssen's avatar Tim Jenssen
Browse files

QmlDesigner: handle missing item library images better

 - in case of missing (image) file it generated a strange path
 - warn about not existing file path while it reads it from
   MetaInfoReader, to avoid too much not existing warnings
 - add the default icon code to the image provider

Change-Id: I2ffa9b4f179b82fed73876d3ac006e40d37beae2
Reviewed-by: default avatarThomas Hartmann <>
parent 287217d5
......@@ -38,14 +38,16 @@ ItemLibraryImageProvider::ItemLibraryImageProvider() :
QPixmap ItemLibraryImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
const QPixmap pixmap(Utils::StyleHelper::dpiSpecificImageFile(id));
QPixmap pixmap(Utils::StyleHelper::dpiSpecificImageFile(id));
if (size) {
if (pixmap.isNull())
return pixmap;
if (pixmap.isNull()) {
pixmap = QPixmap(Utils::StyleHelper::dpiSpecificImageFile(
if (requestedSize.isValid())
return pixmap.scaled(requestedSize);
......@@ -147,9 +147,6 @@ QIcon ItemLibraryEntry::typeIcon() const
QString ItemLibraryEntry::libraryEntryIconPath() const
if (m_data->libraryEntryIconPath.isEmpty())
return QStringLiteral(":/ItemLibrary/images/item-default-icon.png");
return m_data->libraryEntryIconPath;
......@@ -313,12 +313,14 @@ void MetaInfoReader::addErrorInvalidType(const QString &typeName)
QString MetaInfoReader::absoluteFilePathForDocument(const QString &relativeFilePath)
QFileInfo fileInfo(relativeFilePath);
if (fileInfo.isAbsolute() && fileInfo.exists())
return relativeFilePath;
if (!fileInfo.isAbsolute() && !fileInfo.exists())
fileInfo.setFile(QFileInfo(m_documentPath).absolutePath() + QStringLiteral("/") + relativeFilePath);
if (fileInfo.exists())
return fileInfo.absoluteFilePath();
return QFileInfo(QFileInfo(m_documentPath).absolutePath() + QStringLiteral("/") + relativeFilePath).absoluteFilePath();
qWarning() << relativeFilePath << "does not exist";
return relativeFilePath;
} //Internal
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