diff options
Diffstat (limited to 'src/imports/controls/universal/Button.qml')
-rw-r--r-- | src/imports/controls/universal/Button.qml | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/imports/controls/universal/Button.qml b/src/imports/controls/universal/Button.qml index 1dc94c89..6954d31a 100644 --- a/src/imports/controls/universal/Button.qml +++ b/src/imports/controls/universal/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,50 +35,42 @@ ****************************************************************************/ import QtQuick 2.6 -import Qt.labs.templates 1.0 as T -import Qt.labs.controls.universal 1.0 +import QtQuick.Templates 2.0 as T +import QtQuick.Controls.Universal 2.0 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 - topPadding: 4 - leftPadding: 8 - rightPadding: 8 - bottomPadding: 4 + padding: 8 + topPadding: padding - 4 + bottomPadding: padding - 4 property bool useSystemFocusVisuals: true - //! [label] - label: Text { - x: control.leftPadding - y: control.topPadding - width: control.availableWidth - height: control.availableHeight - + contentItem: Text { text: control.text font: control.font elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor + opacity: enabled ? 1.0 : 0.2 + color: control.Universal.foreground } - //! [label] - //! [background] background: Rectangle { implicitWidth: 32 implicitHeight: 32 - color: control.pressed ? control.Universal.baseMediumLowColor : + visible: !control.flat || control.down || control.checked || control.highlighted + color: control.down ? control.Universal.baseMediumLowColor : control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : control.Universal.baseLowColor } - //! [background] } |