Checkbox/Standard button development

This commit is contained in:
Sander Ferdinand 2017-12-07 18:19:30 +01:00 committed by moneromooo-monero
parent 948669edbc
commit f48cd1b82b
4 changed files with 26 additions and 8 deletions

View File

@ -88,6 +88,8 @@ RowLayout {
color: "#525252" color: "#525252"
wrapMode: Text.Wrap wrapMode: Text.Wrap
Layout.fillWidth: true Layout.fillWidth: true
anchors.left: backgroundRect.right
anchors.leftMargin: !isMobile ? 10 : 8
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {

View File

@ -39,12 +39,12 @@ Item {
property string releasedColor: Style.buttonBackgroundColor property string releasedColor: Style.buttonBackgroundColor
property string icon: "" property string icon: ""
property string textColor: button.enabled? Style.buttonTextColor: Style.buttonTextColorDisabled property string textColor: button.enabled? Style.buttonTextColor: Style.buttonTextColorDisabled
property int fontSize: 18 * scaleRatio property int fontSize: 16 * scaleRatio
property alias text: label.text property alias text: label.text
signal clicked() signal clicked()
// Dynamic label width // Dynamic label width
Layout.minimumWidth: (label.contentWidth > 50)? label.contentWidth + 10 : 60 Layout.minimumWidth: (label.contentWidth > 50)? label.contentWidth + 22 : 60
function doClick() { function doClick() {
// Android workaround // Android workaround
@ -56,16 +56,27 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: parent.height - 1 height: parent.height - 1
y: buttonArea.pressed ? 0 : 1
radius: 3 radius: 3
color: parent.enabled ? Style.buttonBackgroundColor : Style.buttonBackgroundColorDisabled color: parent.enabled ? Style.buttonBackgroundColor : Style.buttonBackgroundColorDisabled
// color: {
// parent.enabled ? (buttonArea.pressed ? parent.shadowPressedColor : parent.shadowReleasedColor)
// : Qt.lighter(parent.shadowReleasedColor)
// }
border.color: Qt.darker(parent.releasedColor) border.color: Qt.darker(parent.releasedColor)
border.width: parent.focus ? 1 : 0 border.width: parent.focus ? 1 : 0
MouseArea{
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
propagateComposedEvents: true
onEntered: {
if(button.enabled) parent.color = Style.buttonBackgroundColorHover;
else parent.color = Style.buttonBackgroundColorDisabledHover;
}
onExited: {
if(button.enabled) parent.color = Style.buttonBackgroundColor;
else parent.color = Style.buttonBackgroundColorDisabled;
}
}
} }
// Rectangle { // Rectangle {
@ -91,7 +102,7 @@ Item {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.family: Style.fontBold.name font.family: Style.fontBold.name
font.bold: true font.bold: true
font.pixelSize: button.fontSize font.pixelSize: buttonArea.pressed ? button.fontSize - 1 : button.fontSize
color: parent.textColor color: parent.textColor
visible: parent.icon === "" visible: parent.icon === ""
// font.capitalization : Font.Capitalize // font.capitalization : Font.Capitalize

View File

@ -12,8 +12,12 @@ QtObject {
property string inputBoxBackground: "black" property string inputBoxBackground: "black"
property string inputBoxBackgroundError: "#FFDDDD" property string inputBoxBackgroundError: "#FFDDDD"
property string inputBoxColor: "white" property string inputBoxColor: "white"
property string buttonBackgroundColor: "#FA6800" property string buttonBackgroundColor: "#FA6800"
property string buttonBackgroundColorHover: "#E65E00"
property string buttonBackgroundColorDisabled: "#3B3B3B" property string buttonBackgroundColorDisabled: "#3B3B3B"
property string buttonBackgroundColorDisabledHover: "#4F4F4F"
property string buttonTextColor: "white" property string buttonTextColor: "white"
property string buttonTextColorDisabled: "black" property string buttonTextColorDisabled: "black"
property string dividerColor: "white" property string dividerColor: "white"

View File

@ -274,6 +274,7 @@ Rectangle {
id: blockchainFolder id: blockchainFolder
Layout.preferredWidth: 200 Layout.preferredWidth: 200
Layout.fillWidth: true Layout.fillWidth: true
labelText: qsTr("Blockchain location") + translationManager.emptyString
text: persistentSettings.blockchainDataDir text: persistentSettings.blockchainDataDir
placeholderText: qsTr("(optional)") + translationManager.emptyString placeholderText: qsTr("(optional)") + translationManager.emptyString