forked from qt-creator/qt-creator
QmlDesigner: Further reduce the direct dependecy on GradientLine
Change-Id: I1c7d9b87f2b2c16393bd672fe80356aca8b6e2d3 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -109,14 +109,12 @@ SecondColumnLayout {
|
|||||||
if (colorEditor.supportGradient && cePopup.gradientModel.hasGradient) {
|
if (colorEditor.supportGradient && cePopup.gradientModel.hasGradient) {
|
||||||
var hexColor = convertColorToString(colorEditor.color)
|
var hexColor = convertColorToString(colorEditor.color)
|
||||||
hexTextField.text = hexColor
|
hexTextField.text = hexColor
|
||||||
cePopup.popupHexTextField.text = hexColor
|
cePopup.commitGradientColor()
|
||||||
cePopup.gradientLine.currentColor = colorEditor.color
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delay setting the color to keep ui responsive
|
// Delay setting the color to keep ui responsive
|
||||||
if (cePopup.isNotInGradientMode())
|
if (cePopup.isNotInGradientMode())
|
||||||
colorEditorTimer.restart(
|
colorEditorTimer.restart()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer {
|
Spacer {
|
||||||
|
@@ -37,13 +37,19 @@ T.Popup {
|
|||||||
|
|
||||||
property alias gradientLine: gradientLine
|
property alias gradientLine: gradientLine
|
||||||
property alias popupHexTextField: popupHexTextField
|
property alias popupHexTextField: popupHexTextField
|
||||||
property alias gradientPropertyName: cePopup.gradientLine.gradientPropertyName
|
property alias gradientPropertyName: cePopup.gradientModel.gradientPropertyName
|
||||||
property alias gradientOrientation: gradientOrientation
|
property alias gradientOrientation: gradientOrientation
|
||||||
|
|
||||||
property alias gradientModel: gradientModel
|
property alias gradientModel: gradientModel
|
||||||
|
|
||||||
property bool isInValidState: false
|
property bool isInValidState: false
|
||||||
|
|
||||||
|
function commitGradientColor() {
|
||||||
|
var hexColor = convertColorToString(colorEditor.color)
|
||||||
|
cePopup.popupHexTextField.text = hexColor
|
||||||
|
cePopup.gradientLine.currentColor = colorEditor.color
|
||||||
|
}
|
||||||
|
|
||||||
function isNotInGradientMode() {
|
function isNotInGradientMode() {
|
||||||
return ceMode.currentValue === "Solid"
|
return ceMode.currentValue === "Solid"
|
||||||
}
|
}
|
||||||
@@ -123,7 +129,7 @@ T.Popup {
|
|||||||
=== Gradient.Horizontal ? "Gradient.Horizontal" : "Gradient.Vertical"
|
=== Gradient.Horizontal ? "Gradient.Horizontal" : "Gradient.Vertical"
|
||||||
gradientString += "orientation: " + orientation + ";"
|
gradientString += "orientation: " + orientation + ";"
|
||||||
|
|
||||||
for (var i = 0; i < cePopup.gradientLine.model.count; i++)
|
for (var i = 0; i < gradientModel.count; i++)
|
||||||
gradientString += "GradientStop {}"
|
gradientString += "GradientStop {}"
|
||||||
|
|
||||||
gradientString += "}"
|
gradientString += "}"
|
||||||
@@ -132,10 +138,10 @@ T.Popup {
|
|||||||
gradientString, colorEditor.gradientThumbnail,
|
gradientString, colorEditor.gradientThumbnail,
|
||||||
"dynamicGradient")
|
"dynamicGradient")
|
||||||
|
|
||||||
for (i = 0; i < cePopup.gradientLine.model.count; i++) {
|
for (i = 0; i < gradientModel.count; i++) {
|
||||||
gradientObject.stops[i].color = cePopup.gradientLine.model.getColor(
|
gradientObject.stops[i].color = gradientModel.getColor(
|
||||||
i)
|
i)
|
||||||
gradientObject.stops[i].position = cePopup.gradientLine.model.getPosition(
|
gradientObject.stops[i].position = gradientModel.getPosition(
|
||||||
i)
|
i)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,10 +172,10 @@ T.Popup {
|
|||||||
gradientStr, colorEditor.shapeGradientThumbnail,
|
gradientStr, colorEditor.shapeGradientThumbnail,
|
||||||
"dynamicShapeGradient")
|
"dynamicShapeGradient")
|
||||||
|
|
||||||
for (j = 0; j < cePopup.gradientLine.model.count; j++) {
|
for (j = 0; j < gradientModel.count; j++) {
|
||||||
gradientObj.stops[j].color = cePopup.gradientLine.model.getColor(
|
gradientObj.stops[j].color = gradientModel.getColor(
|
||||||
j)
|
j)
|
||||||
gradientObj.stops[j].position = cePopup.gradientLine.model.getPosition(
|
gradientObj.stops[j].position = gradientModel.getPosition(
|
||||||
j)
|
j)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user