From ab0f772c07436a127fcb28b9b2a8f36d00813adf Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Wed, 14 Mar 2018 11:59:36 -0400 Subject: [PATCH] More merge conflict errors --- src/QmlControls/QGCButton.qml | 65 ++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/src/QmlControls/QGCButton.qml b/src/QmlControls/QGCButton.qml index f7adf355b..8337459bf 100644 --- a/src/QmlControls/QGCButton.qml +++ b/src/QmlControls/QGCButton.qml @@ -8,12 +8,15 @@ import QGroundControl.ScreenTools 1.0 Button { activeFocusOnPress: true - property bool primary: false ///< primary button for a group of buttons - property real pointSize: ScreenTools.defaultFontPointSize ///< Point size for button text + property bool primary: false ///< primary button for a group of buttons + property real pointSize: ScreenTools.defaultFontPointSize ///< Point size for button text + property bool showBorder: _qgcPal.globalTheme === QGCPalette.Light + property bool iconLeft: false + property real backRadius: 0 + property real heightFactor: 0.5 property var _qgcPal: QGCPalette { colorGroupEnabled: enabled } property bool _showHighlight: (pressed | hovered | checked) && !__forceHoverOff - property bool _showBorder: _qgcPal.globalTheme === QGCPalette.Light // This fixes the issue with button hover where if a Button is near the edge oa QQuickWidget you can // move the mouse fast enough such that the MouseArea does not trigger an onExited. This is turn @@ -24,7 +27,7 @@ Button { property int __lastGlobalMouseX: 0 property int __lastGlobalMouseY: 0 property int _horizontalPadding: ScreenTools.defaultFontPixelWidth - property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight / 2) + property int _verticalPadding: Math.round(ScreenTools.defaultFontPixelHeight * heightFactor) Connections { target: __behavior @@ -60,9 +63,11 @@ Button { /*! This defines the background of the button. */ background: Rectangle { + id: backRect implicitWidth: ScreenTools.implicitButtonWidth implicitHeight: ScreenTools.implicitButtonHeight - border.width: _showBorder ? 1: 0 + radius: backRadius + border.width: showBorder ? 1 : 0 border.color: _qgcPal.buttonText color: _showHighlight ? control._qgcPal.buttonHighlight : @@ -71,31 +76,35 @@ Button { /*! This defines the label of the button. */ label: Item { - implicitWidth: row.implicitWidth - implicitHeight: row.implicitHeight - baselineOffset: row.y + text.y + text.baselineOffset + implicitWidth: text.implicitWidth + icon.width + implicitHeight: text.implicitHeight + baselineOffset: text.y + text.baselineOffset - Row { - id: row - anchors.centerIn: parent - spacing: ScreenTools.defaultFontPixelWidth * 0.25 - - Image { - source: control.iconSource - anchors.verticalCenter: parent.verticalCenter - } + QGCColoredImage { + id: icon + source: control.iconSource + height: source === "" ? 0 : text.height + width: height + color: text.color + fillMode: Image.PreserveAspectFit + sourceSize.height: height + anchors.left: control.iconLeft ? parent.left : undefined + anchors.leftMargin: control.iconLeft ? ScreenTools.defaultFontPixelWidth : undefined + anchors.right: !control.iconLeft ? parent.right : undefined + anchors.rightMargin: !control.iconLeft ? ScreenTools.defaultFontPixelWidth : undefined + anchors.verticalCenter: parent.verticalCenter + } - Text { - id: text - anchors.verticalCenter: parent.verticalCenter - antialiasing: true - text: control.text - font.pointSize: pointSize - font.family: ScreenTools.normalFontFamily - color: _showHighlight ? - control._qgcPal.buttonHighlightText : - (primary ? control._qgcPal.primaryButtonText : control._qgcPal.buttonText) - } + Text { + id: text + anchors.centerIn: parent + antialiasing: true + text: control.text + font.pointSize: pointSize + font.family: ScreenTools.normalFontFamily + color: _showHighlight ? + control._qgcPal.buttonHighlightText : + (primary ? control._qgcPal.primaryButtonText : control._qgcPal.buttonText) } } } -- 2.22.0