From a526619f4b9fd9294e0cc267a67475d73a51a68e Mon Sep 17 00:00:00 2001 From: Jaquee Date: Sat, 31 Dec 2016 11:22:23 +0100 Subject: [PATCH] Dynamically adjust balance fontsize --- LeftPanel.qml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/LeftPanel.qml b/LeftPanel.qml index d4871059..b42f6d81 100644 --- a/LeftPanel.qml +++ b/LeftPanel.qml @@ -131,9 +131,17 @@ Rectangle { id: balanceText anchors.verticalCenter: parent.verticalCenter font.family: "Arial" - font.pixelSize: 26 color: "#000000" text: "N/A" + // dynamically adjust text size + font.pixelSize: { + var digits = text.split('.')[0].length + var defaultSize = 25; + if(digits > 2) { + return defaultSize - 1.1*digits + } + return defaultSize; + } } } @@ -155,9 +163,17 @@ Rectangle { anchors.left: parent.left anchors.leftMargin: 50 font.family: "Arial" - font.pixelSize: 18 color: "#000000" text: "N/A" + // dynamically adjust text size + font.pixelSize: { + var digits = text.split('.')[0].length + var defaultSize = 18; + if(digits > 3) { + return defaultSize - 0.6*digits + } + return defaultSize; + } } }