mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-11-04 09:02:14 +00:00 
			
		
		
		
	Fix bad behavior of ColorButton and ColorDialog.
This commit is contained in:
		@@ -22,8 +22,8 @@ import QtQuick 2.2
 | 
				
			|||||||
import QtQuick.Dialogs 1.1
 | 
					import QtQuick.Dialogs 1.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Item {
 | 
					Item {
 | 
				
			||||||
    signal colorSelected (color color)
 | 
					    id: rootItem
 | 
				
			||||||
    property color button_color
 | 
					    property alias color: colorDialog.color
 | 
				
			||||||
    property string name
 | 
					    property string name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ColorDialog {
 | 
					    ColorDialog {
 | 
				
			||||||
@@ -31,15 +31,11 @@ Item {
 | 
				
			|||||||
        title: qsTr("Choose a color")
 | 
					        title: qsTr("Choose a color")
 | 
				
			||||||
        modality: Qt.ApplicationModal
 | 
					        modality: Qt.ApplicationModal
 | 
				
			||||||
        visible: false
 | 
					        visible: false
 | 
				
			||||||
 | 
					 | 
				
			||||||
        //This is a workaround to a Qt 5.2 bug.
 | 
					 | 
				
			||||||
        onCurrentColorChanged: colorDialog.color = colorDialog.currentColor;
 | 
					 | 
				
			||||||
        onAccepted: colorSelected(color)
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    Rectangle{
 | 
					    Rectangle{
 | 
				
			||||||
        anchors.fill: parent
 | 
					        anchors.fill: parent
 | 
				
			||||||
        radius: 10
 | 
					        radius: 10
 | 
				
			||||||
        color: button_color
 | 
					        color: rootItem.color
 | 
				
			||||||
        border.color: "black"
 | 
					        border.color: "black"
 | 
				
			||||||
        Glossy {}
 | 
					        Glossy {}
 | 
				
			||||||
        Rectangle {
 | 
					        Rectangle {
 | 
				
			||||||
@@ -52,7 +48,7 @@ Item {
 | 
				
			|||||||
        Text{
 | 
					        Text{
 | 
				
			||||||
            anchors.centerIn: parent
 | 
					            anchors.centerIn: parent
 | 
				
			||||||
            z: parent.z + 1
 | 
					            z: parent.z + 1
 | 
				
			||||||
            text: name + ":  " + button_color
 | 
					            text: name + ":  " + rootItem.color
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    MouseArea{
 | 
					    MouseArea{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,18 +121,24 @@ Tab{
 | 
				
			|||||||
                RowLayout{
 | 
					                RowLayout{
 | 
				
			||||||
                    Layout.fillWidth: true
 | 
					                    Layout.fillWidth: true
 | 
				
			||||||
                    ColorButton{
 | 
					                    ColorButton{
 | 
				
			||||||
 | 
					                        property color settingsColor: appSettings._fontColor
 | 
				
			||||||
 | 
					                        onSettingsColorChanged: color = settingsColor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        name: qsTr("Font")
 | 
					                        name: qsTr("Font")
 | 
				
			||||||
                        height: 50
 | 
					                        height: 50
 | 
				
			||||||
                        Layout.fillWidth: true
 | 
					                        Layout.fillWidth: true
 | 
				
			||||||
                        onColorSelected: appSettings._fontColor = color;
 | 
					                        onColorChanged: appSettings._fontColor = color
 | 
				
			||||||
                        button_color: appSettings._fontColor
 | 
					                        Component.onCompleted: { color = settingsColor; }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    ColorButton{
 | 
					                    ColorButton{
 | 
				
			||||||
 | 
					                        property color settingsColor: appSettings._backgroundColor
 | 
				
			||||||
 | 
					                        onSettingsColorChanged: color = settingsColor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        name: qsTr("Background")
 | 
					                        name: qsTr("Background")
 | 
				
			||||||
                        height: 50
 | 
					                        height: 50
 | 
				
			||||||
                        Layout.fillWidth: true
 | 
					                        Layout.fillWidth: true
 | 
				
			||||||
                        onColorSelected: appSettings._backgroundColor = color;
 | 
					                        onColorChanged: appSettings._backgroundColor = color
 | 
				
			||||||
                        button_color: appSettings._backgroundColor
 | 
					                        Component.onCompleted: { color = settingsColor;}
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user