forked from qt-creator/qt-creator
35 lines
856 B
QML
35 lines
856 B
QML
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
||
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||
|
|
|
||
|
|
import QtQuick 2.15
|
||
|
|
import QtQuick.Layouts 1.15
|
||
|
|
import QtQuickDesignerTheme 1.0
|
||
|
|
import HelperWidgets 2.0
|
||
|
|
import QtQuick.Controls
|
||
|
|
|
||
|
|
import StudioTheme 1.0 as StudioTheme
|
||
|
|
|
||
|
|
Image {
|
||
|
|
id: root
|
||
|
|
|
||
|
|
source: modelData.textureIcon
|
||
|
|
visible: modelData.textureVisible
|
||
|
|
cache: false
|
||
|
|
|
||
|
|
signal showContextMenu()
|
||
|
|
|
||
|
|
MouseArea {
|
||
|
|
id: mouseArea
|
||
|
|
|
||
|
|
anchors.fill: parent
|
||
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||
|
|
|
||
|
|
onPressed: (mouse) => {
|
||
|
|
if (mouse.button === Qt.LeftButton)
|
||
|
|
rootView.startDragTexture(modelData, mapToGlobal(mouse.x, mouse.y))
|
||
|
|
else if (mouse.button === Qt.RightButton)
|
||
|
|
root.showContextMenu()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|