From 42bf81201932158a8dae7d7bc70c39495f34b888 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Wed, 13 Mar 2019 15:03:29 -0700 Subject: [PATCH] Case 21704 - marketplace button formatting fixes --- interface/resources/qml/controlsUit/Button.qml | 10 ++++++++++ .../qml/hifi/commerce/marketplace/MarketplaceItem.qml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/controlsUit/Button.qml b/interface/resources/qml/controlsUit/Button.qml index 3c5626e29e..6da85ed6d3 100644 --- a/interface/resources/qml/controlsUit/Button.qml +++ b/interface/resources/qml/controlsUit/Button.qml @@ -143,6 +143,16 @@ Original.Button { horizontalAlignment: Text.AlignHCenter text: control.text Component.onCompleted: { + setTextPosition(); + } + onTextChanged: { + setTextPosition(); + } + function setTextPosition() { + // force TextMetrics to re-evaluate the text field and glyph sizes + // as for some reason it's not automatically being done. + buttonGlyphTextMetrics.text = buttonGlyph.text; + buttonTextMetrics.text = text; if (control.buttonGlyph !== "") { buttonText.x = buttonContentItem.width/2 - buttonTextMetrics.width/2 + (buttonGlyphTextMetrics.width + control.buttonGlyphRightMargin)/2; } else { diff --git a/interface/resources/qml/hifi/commerce/marketplace/MarketplaceItem.qml b/interface/resources/qml/hifi/commerce/marketplace/MarketplaceItem.qml index 605a68fe73..ce692c04d9 100644 --- a/interface/resources/qml/hifi/commerce/marketplace/MarketplaceItem.qml +++ b/interface/resources/qml/hifi/commerce/marketplace/MarketplaceItem.qml @@ -298,7 +298,7 @@ Rectangle { property bool isFreeSpecial: isStocking || isUpdate enabled: isFreeSpecial || (availability === 'available') buttonGlyph: (enabled && !isUpdate && (price > 0)) ? hifi.glyphs.hfc : "" - text: isUpdate ? "UPDATE FOR FREE" : (isStocking ? "FREE STOCK" : (enabled ? (price || "FREE") : availability)) + text: isUpdate ? "UPDATE" : (isStocking ? "FREE STOCK" : (enabled ? (price || "FREE") : availability)) color: hifi.buttons.blue buttonGlyphSize: 24