summaryrefslogtreecommitdiff
path: root/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml
diff options
context:
space:
mode:
Diffstat (limited to 'share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml')
-rw-r--r--share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml34
1 files changed, 33 insertions, 1 deletions
diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml
index c717852649..1d5d2434c6 100644
--- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml
+++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/AssetDelegate.qml
@@ -182,9 +182,36 @@ TreeViewDelegate {
}
ToolTip {
+ id: assetTooltip
visible: !root.isFont && mouseArea.containsMouse && !root.assetsView.contextMenu.visible
- text: model.filePath
+ text: assetTooltip.__computeText()
delay: 1000
+
+ function __computeText()
+ {
+ let filePath = model.filePath.replace(assetsModel.contentDirPath(), "")
+ let fileSize = rootView.assetFileSize(model.filePath)
+ let fileExtMatches = model.filePath.match(/\.(.*)$/)
+ let fileExt = fileExtMatches ? "(" + fileExtMatches[1] + ")" : ""
+
+ if (rootView.assetIsImage(model.filePath)) {
+ let size = rootView.imageSize(model.filePath)
+
+ return filePath + "\n"
+ + size.width + " x " + size.height
+ + "\n" + fileSize
+ + " " + fileExt
+ } else {
+ return filePath + "\n"
+ + fileSize
+ + " " + fileExt
+ }
+ }
+
+ function refresh()
+ {
+ text = assetTooltip.__computeText()
+ }
}
Timer {
@@ -293,5 +320,10 @@ TreeViewDelegate {
: "image://qmldesigner_assets/" + model.filePath
}
+ onStatusChanged: {
+ if (thumbnailImage.status === Image.Ready)
+ assetTooltip.refresh()
+ }
+
} // Image
} // TreeViewDelegate