blob: 3492a1dfef3c2a46662eb927ae2d262b79fdc19c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuickDesignerTheme
import HelperWidgets
import StudioTheme as StudioTheme
Rectangle {
id: root
visible: textureVisible
color: "transparent"
border.width: materialBrowserTexturesModel.selectedIndex === index
? !rootView.materialSectionFocused ? 3 : 1 : 0
border.color: materialBrowserTexturesModel.selectedIndex === index
? StudioTheme.Values.themeControlOutlineInteraction
: "transparent"
signal showContextMenu()
MouseArea {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
onPressed: (mouse) => {
rootView.focusMaterialSection(false)
materialBrowserTexturesModel.selectTexture(index)
if (mouse.button === Qt.LeftButton)
rootView.startDragTexture(index, mapToGlobal(mouse.x, mouse.y))
else if (mouse.button === Qt.RightButton)
root.showContextMenu()
}
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 {
source: "image://materialBrowserTex/" + textureSource
asynchronous: true
sourceSize.width: root.width - 10
sourceSize.height: root.height - 10
anchors.centerIn: parent
smooth: true
}
}
|