QmlDesigner: Add a tooltip to material browser textures

Change-Id: I5a2dd41602bb03357fdd1b7280242f6ea43ff56f
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Mahmoud Badri
2022-12-01 14:13:33 +02:00
parent 5f7d36d1cb
commit fd4d1f08fa

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import QtQuickDesignerTheme import QtQuickDesignerTheme
import HelperWidgets import HelperWidgets
@@ -26,6 +27,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
onPressed: (mouse) => { onPressed: (mouse) => {
rootView.focusMaterialSection(false) rootView.focusMaterialSection(false)
@@ -40,6 +42,14 @@ Rectangle {
onDoubleClicked: materialBrowserTexturesModel.openTextureEditor(); onDoubleClicked: materialBrowserTexturesModel.openTextureEditor();
} }
ToolTip {
property bool hasSource: textureSource.slice(-1) !== "/"
visible: mouseArea.containsMouse
text: hasSource ? textureSource : qsTr("Texture has no source image.")
delay: 1000
}
Image { Image {
source: "image://materialBrowserTex/" + textureSource source: "image://materialBrowserTex/" + textureSource
asynchronous: true asynchronous: true