Fix bad behaving color dialog on some platforms.

This commit is contained in:
Filippo Scognamiglio 2014-12-30 10:25:33 +01:00
parent a63135045e
commit d10bf29493
2 changed files with 9 additions and 7 deletions

View File

@ -22,8 +22,10 @@ import QtQuick 2.2
import QtQuick.Dialogs 1.1
Item {
id: rootItem
signal colorSelected (color color)
property color button_color
property color color
property string name
ColorDialog {
@ -33,13 +35,13 @@ Item {
visible: false
//This is a workaround to a Qt 5.2 bug.
onCurrentColorChanged: colorDialog.color = colorDialog.currentColor;
onAccepted: colorSelected(color)
onColorChanged: if (Qt.platform.os !== "osx") colorSelected(color)
onAccepted: if (Qt.platform.os === "osx") colorSelected(color)
}
Rectangle{
anchors.fill: parent
radius: 10
color: button_color
color: rootItem.color
border.color: "black"
Glossy {}
Rectangle {
@ -52,7 +54,7 @@ Item {
Text{
anchors.centerIn: parent
z: parent.z + 1
text: name + ": " + button_color
text: name + ": " + rootItem.color
}
}
MouseArea{

View File

@ -125,14 +125,14 @@ Tab{
height: 50
Layout.fillWidth: true
onColorSelected: appSettings._fontColor = color;
button_color: appSettings._fontColor
color: appSettings._fontColor
}
ColorButton{
name: qsTr("Background")
height: 50
Layout.fillWidth: true
onColorSelected: appSettings._backgroundColor = color;
button_color: appSettings._backgroundColor
color: appSettings._backgroundColor
}
}
}