[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [gcompris/gsoc_pulkit_digital_electricity] src/activities/digital_electricity: digital_electricity: 
From:       Rudra Nil Basu <null () kde ! org>
Date:       2017-08-27 19:20:31
Message-ID: E1dm36l-00075X-52 () code ! kde ! org
[Download RAW message or body]

Git commit 138dacd0a820c94af6ca720baa928ea9b3fcdac3 by Rudra Nil Basu.
Committed on 27/08/2017 at 19:13.
Pushed by rudranilbasu into branch 'gsoc_pulkit_digital_electricity'.

digital_electricity: Used Text.Fit to fit text with button

In a612172 "Adapt tools text size with button", we updated the scale of
the text element depending on whether it exceeded the width of the
button or not. This has been changed to using Text.Fit to make sure that
the text remains within it's prescribed width, which is set to be the
same as that of the width of the button. Also, we align the text
horizontally using Text.AlignHCenter

Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>

M  +4    -2    src/activities/digital_electricity/ListWidget.qml

https://commits.kde.org/gcompris/138dacd0a820c94af6ca720baa928ea9b3fcdac3

diff --git a/src/activities/digital_electricity/ListWidget.qml b/src/activi=
ties/digital_electricity/ListWidget.qml
index 2b0a25b9..e84ea33b 100644
--- a/src/activities/digital_electricity/ListWidget.qml
+++ b/src/activities/digital_electricity/ListWidget.qml
@@ -109,10 +109,12 @@ Item {
             property bool showToolBar: false
 =

             GCText {
-                anchors.centerIn: parent
+                width: parent.width
+                fontSizeMode: Text.Fit
                 color: "white"
                 text: qsTr("Tools")
-                scale: paintedWidth > toolButton.width ? (toolButton.width=
 / paintedWidth) : 1
+                anchors.centerIn: parent
+                horizontalAlignment: Text.AlignHCenter
             }
 =

             MouseArea {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic