forked from qt-creator/qt-creator
QmlDesigner: Allow material browser texture selection
For now texture selection is independent from material selection. Change-Id: Iffa8354948f0ce64e4a54458531274e0441e87ea Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -221,7 +221,6 @@ Item {
|
||||
leftPadding: 5
|
||||
rightPadding: 5
|
||||
bottomPadding: 5
|
||||
spacing: 5
|
||||
columns: root.width / root.cellWidth
|
||||
|
||||
Repeater {
|
||||
|
||||
@@ -7,14 +7,16 @@ import QtQuickDesignerTheme
|
||||
import HelperWidgets
|
||||
import StudioTheme as StudioTheme
|
||||
|
||||
Image {
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
source: textureSource
|
||||
sourceSize.width: root.width
|
||||
sourceSize.height: root.height
|
||||
visible: textureVisible
|
||||
cache: false
|
||||
|
||||
color: "transparent"
|
||||
border.width: materialBrowserTexturesModel.selectedIndex === index ? 1 : 0
|
||||
border.color: materialBrowserTexturesModel.selectedIndex === index
|
||||
? StudioTheme.Values.themeControlOutlineInteraction
|
||||
: "transparent"
|
||||
|
||||
signal showContextMenu()
|
||||
|
||||
@@ -25,10 +27,20 @@ Image {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
|
||||
onPressed: (mouse) => {
|
||||
materialBrowserTexturesModel.selectTexture(index)
|
||||
|
||||
if (mouse.button === Qt.LeftButton)
|
||||
rootView.startDragTexture(index, mapToGlobal(mouse.x, mouse.y))
|
||||
else if (mouse.button === Qt.RightButton)
|
||||
root.showContextMenu()
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
source: textureSource
|
||||
sourceSize.width: root.width - 10
|
||||
sourceSize.height: root.height - 10
|
||||
anchors.centerIn: parent
|
||||
cache: false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user