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
|
leftPadding: 5
|
||||||
rightPadding: 5
|
rightPadding: 5
|
||||||
bottomPadding: 5
|
bottomPadding: 5
|
||||||
spacing: 5
|
|
||||||
columns: root.width / root.cellWidth
|
columns: root.width / root.cellWidth
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
|||||||
@@ -7,14 +7,16 @@ import QtQuickDesignerTheme
|
|||||||
import HelperWidgets
|
import HelperWidgets
|
||||||
import StudioTheme as StudioTheme
|
import StudioTheme as StudioTheme
|
||||||
|
|
||||||
Image {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
source: textureSource
|
|
||||||
sourceSize.width: root.width
|
|
||||||
sourceSize.height: root.height
|
|
||||||
visible: textureVisible
|
visible: textureVisible
|
||||||
cache: false
|
|
||||||
|
color: "transparent"
|
||||||
|
border.width: materialBrowserTexturesModel.selectedIndex === index ? 1 : 0
|
||||||
|
border.color: materialBrowserTexturesModel.selectedIndex === index
|
||||||
|
? StudioTheme.Values.themeControlOutlineInteraction
|
||||||
|
: "transparent"
|
||||||
|
|
||||||
signal showContextMenu()
|
signal showContextMenu()
|
||||||
|
|
||||||
@@ -25,10 +27,20 @@ Image {
|
|||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
|
||||||
onPressed: (mouse) => {
|
onPressed: (mouse) => {
|
||||||
|
materialBrowserTexturesModel.selectTexture(index)
|
||||||
|
|
||||||
if (mouse.button === Qt.LeftButton)
|
if (mouse.button === Qt.LeftButton)
|
||||||
rootView.startDragTexture(index, mapToGlobal(mouse.x, mouse.y))
|
rootView.startDragTexture(index, mapToGlobal(mouse.x, mouse.y))
|
||||||
else if (mouse.button === Qt.RightButton)
|
else if (mouse.button === Qt.RightButton)
|
||||||
root.showContextMenu()
|
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