mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-19 10:31:09 +00:00
Merge pull request #373
a526619
Dynamically adjust balance fontsize (Jaquee)
This commit is contained in:
commit
f3e20e746e
1 changed files with 18 additions and 2 deletions
|
@ -131,9 +131,17 @@ Rectangle {
|
||||||
id: balanceText
|
id: balanceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
font.pixelSize: 26
|
|
||||||
color: "#000000"
|
color: "#000000"
|
||||||
text: "N/A"
|
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.left: parent.left
|
||||||
anchors.leftMargin: 50
|
anchors.leftMargin: 50
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
font.pixelSize: 18
|
|
||||||
color: "#000000"
|
color: "#000000"
|
||||||
text: "N/A"
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue