mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-01-22 20:04:32 +08:00
Merge pull request #582 from luckyloogn/fix/color-picker-sync-issues
修复 FluColorPicker 存在的颜色同步与输入问题
This commit is contained in:
commit
985e90bffc
@ -47,6 +47,17 @@ Button{
|
|||||||
implicitWidth: 326
|
implicitWidth: 326
|
||||||
implicitHeight: 560
|
implicitHeight: 560
|
||||||
closePolicy: Popup.CloseOnEscape
|
closePolicy: Popup.CloseOnEscape
|
||||||
|
onClosed: {
|
||||||
|
text_box_r.focus = false;
|
||||||
|
text_box_g.focus = false;
|
||||||
|
text_box_b.focus = false;
|
||||||
|
text_box_a.focus = false;
|
||||||
|
text_box_color.focus = false;
|
||||||
|
}
|
||||||
|
onOpened: {
|
||||||
|
layout_color_hue.updateColorText(current);
|
||||||
|
text_box_color.textEdited();
|
||||||
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:layout_actions
|
id:layout_actions
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -148,7 +159,9 @@ Button{
|
|||||||
if(color.a===1){
|
if(color.a===1){
|
||||||
colorString = "FF"+colorString
|
colorString = "FF"+colorString
|
||||||
}
|
}
|
||||||
text_box_color.text = colorString.toUpperCase()
|
if (!text_box_color.activeFocus) {
|
||||||
|
text_box_color.text = colorString.toUpperCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
property color blackColor: {
|
property color blackColor: {
|
||||||
var c = whiteColor
|
var c = whiteColor
|
||||||
@ -279,6 +292,11 @@ Button{
|
|||||||
preventStealing: true
|
preventStealing: true
|
||||||
function handleMouse(mouse) {
|
function handleMouse(mouse) {
|
||||||
if (mouse.buttons & Qt.LeftButton) {
|
if (mouse.buttons & Qt.LeftButton) {
|
||||||
|
text_box_r.focus = false;
|
||||||
|
text_box_g.focus = false;
|
||||||
|
text_box_b.focus = false;
|
||||||
|
text_box_a.focus = false;
|
||||||
|
text_box_color.focus = false;
|
||||||
pickerCursor.x = Math.max(0,Math.min(mouse.x - colorHandleRadius,width-2*colorHandleRadius));
|
pickerCursor.x = Math.max(0,Math.min(mouse.x - colorHandleRadius,width-2*colorHandleRadius));
|
||||||
pickerCursor.y = Math.max(0,Math.min(mouse.y - colorHandleRadius,height-2*colorHandleRadius));
|
pickerCursor.y = Math.max(0,Math.min(mouse.y - colorHandleRadius,height-2*colorHandleRadius));
|
||||||
}
|
}
|
||||||
@ -369,6 +387,11 @@ Button{
|
|||||||
preventStealing: true
|
preventStealing: true
|
||||||
function handleMouse(mouse) {
|
function handleMouse(mouse) {
|
||||||
if (mouse.buttons & Qt.LeftButton) {
|
if (mouse.buttons & Qt.LeftButton) {
|
||||||
|
text_box_r.focus = false;
|
||||||
|
text_box_g.focus = false;
|
||||||
|
text_box_b.focus = false;
|
||||||
|
text_box_a.focus = false;
|
||||||
|
text_box_color.focus = false;
|
||||||
blackCursor.x = Math.max(0,Math.min(mouse.x - 6,width-2*6));
|
blackCursor.x = Math.max(0,Math.min(mouse.x - 6,width-2*6));
|
||||||
blackCursor.y = 0
|
blackCursor.y = 0
|
||||||
}
|
}
|
||||||
@ -438,6 +461,11 @@ Button{
|
|||||||
preventStealing: true
|
preventStealing: true
|
||||||
function handleMouse(mouse) {
|
function handleMouse(mouse) {
|
||||||
if (mouse.buttons & Qt.LeftButton) {
|
if (mouse.buttons & Qt.LeftButton) {
|
||||||
|
text_box_r.focus = false;
|
||||||
|
text_box_g.focus = false;
|
||||||
|
text_box_b.focus = false;
|
||||||
|
text_box_a.focus = false;
|
||||||
|
text_box_color.focus = false;
|
||||||
opacityCursor.x = Math.max(0,Math.min(mouse.x - 6,width-2*6));
|
opacityCursor.x = Math.max(0,Math.min(mouse.x - 6,width-2*6));
|
||||||
opacityCursor.y = 0
|
opacityCursor.y = 0
|
||||||
}
|
}
|
||||||
@ -472,7 +500,7 @@ Button{
|
|||||||
id:text_box_color
|
id:text_box_color
|
||||||
width: 136
|
width: 136
|
||||||
validator: RegularExpressionValidator {
|
validator: RegularExpressionValidator {
|
||||||
regularExpression: /^[0-9A-F]{8}$/
|
regularExpression: /^[0-9A-Fa-f]{8}$/
|
||||||
}
|
}
|
||||||
anchors{
|
anchors{
|
||||||
right: parent.right
|
right: parent.right
|
||||||
@ -495,6 +523,11 @@ Button{
|
|||||||
parseInt(colorString.substring(6, 8), 16) / 255,
|
parseInt(colorString.substring(6, 8), 16) / 255,
|
||||||
parseInt(colorString.substring(0, 2), 16) / 255)
|
parseInt(colorString.substring(0, 2), 16) / 255)
|
||||||
layout_color_hue.colorValue = c
|
layout_color_hue.colorValue = c
|
||||||
|
layout_color_hue.updateColorText(c);
|
||||||
|
text_box_r.textEdited();
|
||||||
|
text_box_g.textEdited();
|
||||||
|
text_box_b.textEdited();
|
||||||
|
text_box_a.textEdited();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,17 @@ Button{
|
|||||||
implicitWidth: 326
|
implicitWidth: 326
|
||||||
implicitHeight: 560
|
implicitHeight: 560
|
||||||
closePolicy: Popup.CloseOnEscape
|
closePolicy: Popup.CloseOnEscape
|
||||||
|
onClosed: {
|
||||||
|
text_box_r.focus = false;
|
||||||
|
text_box_g.focus = false;
|
||||||
|
text_box_b.focus = false;
|
||||||
|
text_box_a.focus = false;
|
||||||
|
text_box_color.focus = false;
|
||||||
|
}
|
||||||
|
onOpened: {
|
||||||
|
layout_color_hue.updateColorText(current);
|
||||||
|
text_box_color.textEdited();
|
||||||
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:layout_actions
|
id:layout_actions
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -149,7 +160,9 @@ Button{
|
|||||||
if(color.a===1){
|
if(color.a===1){
|
||||||
colorString = "FF"+colorString
|
colorString = "FF"+colorString
|
||||||
}
|
}
|
||||||
text_box_color.text = colorString.toUpperCase()
|
if (!text_box_color.activeFocus) {
|
||||||
|
text_box_color.text = colorString.toUpperCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
property color blackColor: {
|
property color blackColor: {
|
||||||
var c = whiteColor
|
var c = whiteColor
|
||||||
@ -280,6 +293,11 @@ Button{
|
|||||||
preventStealing: true
|
preventStealing: true
|
||||||
function handleMouse(mouse) {
|
function handleMouse(mouse) {
|
||||||
if (mouse.buttons & Qt.LeftButton) {
|
if (mouse.buttons & Qt.LeftButton) {
|
||||||
|
text_box_r.focus = false;
|
||||||
|
text_box_g.focus = false;
|
||||||
|
text_box_b.focus = false;
|
||||||
|
text_box_a.focus = false;
|
||||||
|
text_box_color.focus = false;
|
||||||
pickerCursor.x = Math.max(0,Math.min(mouse.x - colorHandleRadius,width-2*colorHandleRadius));
|
pickerCursor.x = Math.max(0,Math.min(mouse.x - colorHandleRadius,width-2*colorHandleRadius));
|
||||||
pickerCursor.y = Math.max(0,Math.min(mouse.y - colorHandleRadius,height-2*colorHandleRadius));
|
pickerCursor.y = Math.max(0,Math.min(mouse.y - colorHandleRadius,height-2*colorHandleRadius));
|
||||||
}
|
}
|
||||||
@ -370,6 +388,11 @@ Button{
|
|||||||
preventStealing: true
|
preventStealing: true
|
||||||
function handleMouse(mouse) {
|
function handleMouse(mouse) {
|
||||||
if (mouse.buttons & Qt.LeftButton) {
|
if (mouse.buttons & Qt.LeftButton) {
|
||||||
|
text_box_r.focus = false;
|
||||||
|
text_box_g.focus = false;
|
||||||
|
text_box_b.focus = false;
|
||||||
|
text_box_a.focus = false;
|
||||||
|
text_box_color.focus = false;
|
||||||
blackCursor.x = Math.max(0,Math.min(mouse.x - 6,width-2*6));
|
blackCursor.x = Math.max(0,Math.min(mouse.x - 6,width-2*6));
|
||||||
blackCursor.y = 0
|
blackCursor.y = 0
|
||||||
}
|
}
|
||||||
@ -439,6 +462,11 @@ Button{
|
|||||||
preventStealing: true
|
preventStealing: true
|
||||||
function handleMouse(mouse) {
|
function handleMouse(mouse) {
|
||||||
if (mouse.buttons & Qt.LeftButton) {
|
if (mouse.buttons & Qt.LeftButton) {
|
||||||
|
text_box_r.focus = false;
|
||||||
|
text_box_g.focus = false;
|
||||||
|
text_box_b.focus = false;
|
||||||
|
text_box_a.focus = false;
|
||||||
|
text_box_color.focus = false;
|
||||||
opacityCursor.x = Math.max(0,Math.min(mouse.x - 6,width-2*6));
|
opacityCursor.x = Math.max(0,Math.min(mouse.x - 6,width-2*6));
|
||||||
opacityCursor.y = 0
|
opacityCursor.y = 0
|
||||||
}
|
}
|
||||||
@ -473,7 +501,7 @@ Button{
|
|||||||
id:text_box_color
|
id:text_box_color
|
||||||
width: 136
|
width: 136
|
||||||
validator: RegularExpressionValidator {
|
validator: RegularExpressionValidator {
|
||||||
regularExpression: /^[0-9A-F]{8}$/
|
regularExpression: /^[0-9A-Fa-f]{8}$/
|
||||||
}
|
}
|
||||||
anchors{
|
anchors{
|
||||||
right: parent.right
|
right: parent.right
|
||||||
@ -496,6 +524,11 @@ Button{
|
|||||||
parseInt(colorString.substring(6, 8), 16) / 255,
|
parseInt(colorString.substring(6, 8), 16) / 255,
|
||||||
parseInt(colorString.substring(0, 2), 16) / 255)
|
parseInt(colorString.substring(0, 2), 16) / 255)
|
||||||
layout_color_hue.colorValue = c
|
layout_color_hue.colorValue = c
|
||||||
|
layout_color_hue.updateColorText(c);
|
||||||
|
text_box_r.textEdited();
|
||||||
|
text_box_g.textEdited();
|
||||||
|
text_box_b.textEdited();
|
||||||
|
text_box_a.textEdited();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user