forked from qt-creator/qt-creator
QmlDesigner Fix for GradientDialog selected item
Change-Id: Ie7f7a7ad79e3e9bcb796f0fedc3b7d5d9cd8b023 Reviewed-by: Brook Cronin <brook.cronin@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -48,6 +48,7 @@ Dialog {
|
|||||||
property int stopsCount;
|
property int stopsCount;
|
||||||
property int presetID;
|
property int presetID;
|
||||||
property int presetType; //default(0) or custom(1)
|
property int presetType; //default(0) or custom(1)
|
||||||
|
property Item selectedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addGradient(stopsPositions, stopsColors, stopsCount) {
|
function addGradient(stopsPositions, stopsColors, stopsCount) {
|
||||||
|
@@ -64,7 +64,6 @@ Rectangle {
|
|||||||
clip: true
|
clip: true
|
||||||
delegate: gradientDelegate
|
delegate: gradientDelegate
|
||||||
|
|
||||||
|
|
||||||
property int gridColumns: width / tabBackground.gridCellWidth;
|
property int gridColumns: width / tabBackground.gridCellWidth;
|
||||||
cellWidth: width / gridColumns
|
cellWidth: width / gridColumns
|
||||||
cellHeight: 180
|
cellHeight: 180
|
||||||
@@ -78,6 +77,8 @@ Rectangle {
|
|||||||
clip: false
|
clip: false
|
||||||
|
|
||||||
property real flexibleWidth: (gradientTable.width - gradientTable.cellWidth * gradientTable.gridColumns) / gradientTable.gridColumns
|
property real flexibleWidth: (gradientTable.width - gradientTable.cellWidth * gradientTable.gridColumns) / gradientTable.gridColumns
|
||||||
|
property bool isSelected: false
|
||||||
|
|
||||||
width: gradientTable.cellWidth + flexibleWidth - 8; height: tabBackground.delegateHeight
|
width: gradientTable.cellWidth + flexibleWidth - 8; height: tabBackground.delegateHeight
|
||||||
radius: 16
|
radius: 16
|
||||||
|
|
||||||
@@ -93,7 +94,11 @@ Rectangle {
|
|||||||
gradientData.presetID = presetID;
|
gradientData.presetID = presetID;
|
||||||
gradientData.presetType = presetTabView.currentIndex
|
gradientData.presetType = presetTabView.currentIndex
|
||||||
|
|
||||||
// console.log( "#" + preset + " " + presetName + " Stops: " + stopsPosList + " Colors: " + stopsColorList);
|
if (gradientData.selectedItem != null)
|
||||||
|
gradientData.selectedItem.isSelected = false
|
||||||
|
|
||||||
|
backgroundCard.isSelected = true
|
||||||
|
gradientData.selectedItem = backgroundCard
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
if (backgroundCard.state != "CLICKED") {
|
if (backgroundCard.state != "CLICKED") {
|
||||||
@@ -107,6 +112,13 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
} //mouseArea
|
} //mouseArea
|
||||||
|
|
||||||
|
onIsSelectedChanged: {
|
||||||
|
if (isSelected)
|
||||||
|
backgroundCard.state = "CLICKED"
|
||||||
|
else
|
||||||
|
backgroundCard.state = "USUAL"
|
||||||
|
}
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "HOVER"
|
name: "HOVER"
|
||||||
@@ -119,6 +131,17 @@ Rectangle {
|
|||||||
border.color: "#029de0"
|
border.color: "#029de0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
State {
|
||||||
|
name: "CLICKED"
|
||||||
|
PropertyChanges {
|
||||||
|
target: backgroundCard
|
||||||
|
color:"#029de0"
|
||||||
|
z: 4
|
||||||
|
clip: true
|
||||||
|
border.width: 1
|
||||||
|
border.color: "#606060"
|
||||||
|
}
|
||||||
|
},
|
||||||
State {
|
State {
|
||||||
name: "USUAL"
|
name: "USUAL"
|
||||||
PropertyChanges
|
PropertyChanges
|
||||||
|
Reference in New Issue
Block a user