diff options
Diffstat (limited to 'src/imports/controls/Button.qml')
-rw-r--r-- | src/imports/controls/Button.qml | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml index 290f4ce4..1a974eed 100644 --- a/src/imports/controls/Button.qml +++ b/src/imports/controls/Button.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL3$ ** Commercial License Usage @@ -35,44 +35,39 @@ ****************************************************************************/ import QtQuick 2.6 -import Qt.labs.templates 1.0 as T +import QtQuick.Templates 2.0 as T T.Button { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - label ? label.implicitWidth + leftPadding + rightPadding : 0) + contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - label ? label.implicitHeight + topPadding + bottomPadding : 0) - baselineOffset: label ? label.y + label.baselineOffset : 0 + contentItem.implicitHeight + topPadding + bottomPadding) + baselineOffset: contentItem.y + contentItem.baselineOffset padding: 6 - leftPadding: 8 - rightPadding: 8 + leftPadding: padding + 2 + rightPadding: padding + 2 - //! [label] - label: Text { - x: control.leftPadding - y: control.topPadding - width: control.availableWidth - height: control.availableHeight + contentItem: Text { text: control.text font: control.font - opacity: enabled || highlighted ? 1 : 0.3 - color: control.highlighted ? "#ffffff" : (control.pressed ? "#26282a" : "#353637") + opacity: enabled || control.highlighted || control.checked ? 1 : 0.3 + color: control.checked || control.highlighted ? "#ffffff" : (control.visualFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637")) horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } - //! [label] - //! [background] background: Rectangle { implicitWidth: 100 implicitHeight: 40 - opacity: enabled ? 1 : 0.3 - color: control.pressed ? (control.highlighted ? "#585a5c" : "#e4e4e4") : (control.highlighted ? "#353637" : "#f6f6f6") - border.color: control.pressed ? "#26282a" : "#353637" + visible: !control.flat || control.down || control.checked || control.highlighted + color: control.checked || control.highlighted ? + (control.visualFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) : + (control.visualFocus ? (control.down ? "#cce0ff" : "#f0f6ff") : (control.down ? "#d0d0d0" : "#e0e0e0")) + border.color: "#0066ff" + border.width: control.visualFocus ? 2 : 0 } - //! [background] } |