From cedf3bd41dd912267d9fc8b4a23b38ee530e4f4e Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Fri, 14 Mar 2014 10:04:30 +0100 Subject: Update zoomed item temperature preferredWidth Now we are using other languages than English, we need to get the translated string of the temperature unit to calculate the expected size. Change-Id: I262d1f5aec4ed5bf316ebf75301073bac5934b67 Reviewed-by: J-P Nurmi --- qml/js/utils.js | 2 +- qml/pages/OneDayZoomItem.qml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/qml/js/utils.js b/qml/js/utils.js index 1326b89..69ab20c 100644 --- a/qml/js/utils.js +++ b/qml/js/utils.js @@ -126,7 +126,7 @@ function getMaxTempLenght(cityModel) { var stringTemp = "555" // temperatures estimated between -55 and +55 if (maxLength === 3) stringTemp = "-" + stringTemp - return stringTemp.substring(0, maxLength) + "°C." + return stringTemp.substring(0, maxLength) } // WeatherModel utils diff --git a/qml/pages/OneDayZoomItem.qml b/qml/pages/OneDayZoomItem.qml index f1dff3b..3b5d853 100644 --- a/qml/pages/OneDayZoomItem.qml +++ b/qml/pages/OneDayZoomItem.qml @@ -119,7 +119,8 @@ GridLayout { Layout.alignment: Qt.AlignCenter } TouchLabel { - Layout.preferredWidth: expectedTextWidth(Utils.getMaxTempLenght(ApplicationInfo.currentCityModel)) + Layout.preferredWidth: expectedTextWidth(Utils.getTempFormat(Utils.getMaxTempLenght(ApplicationInfo.currentCityModel))) + + 4 * ApplicationInfo.ratio property int temp: Utils.getTemperature(root.slider.value, root.model) text : Utils.getTempFormat(temp) color: temp < 0 ? ApplicationInfo.colors.blue : ApplicationInfo.colors.doubleDarkGray -- cgit v1.2.3