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

List:       kde-commits
Subject:    [gcompris/KDE/0.60] src: add textSize property to GCButtonStyle
From:       Bruno Coudoin <bruno.coudoin () gcompris ! net>
Date:       2016-07-02 7:32:41
Message-ID: E1bJFPt-0003Xz-58 () code ! kde ! org
[Download RAW message or body]

Git commit e1a9e6f0344a576b74244a83632eb6b3ec89e15a by Bruno Coudoin, on be=
half of Timoth=C3=A9e Giet.
Committed on 01/07/2016 at 21:35.
Pushed by bcoudoin into branch 'KDE/0.60'.

add textSize property to GCButtonStyle

used in baby wordprocessor activity

M  +6    -9    src/activities/baby_wordprocessor/BabyWordprocessor.qml
M  +19   -1    src/core/GCButtonStyle.qml

http://commits.kde.org/gcompris/e1a9e6f0344a576b74244a83632eb6b3ec89e15a

diff --git a/src/activities/baby_wordprocessor/BabyWordprocessor.qml b/src/=
activities/baby_wordprocessor/BabyWordprocessor.qml
index 47ac16a..f6de8c7 100644
--- a/src/activities/baby_wordprocessor/BabyWordprocessor.qml
+++ b/src/activities/baby_wordprocessor/BabyWordprocessor.qml
@@ -48,7 +48,7 @@ ActivityBase {
 =

         Column {
             id: controls
-            width: 200 * ApplicationInfo.ratio
+            width: 120 * ApplicationInfo.ratio
             anchors {
                 right: parent.right
                 top: parent.top
@@ -58,22 +58,19 @@ ActivityBase {
             spacing: 10
 =

             Button {
-                style: GCButtonStyle {}
-                height: 30 * ApplicationInfo.ratio
-                width: parent.width
+                style: GCButtonStyle { textSize: "title"}
                 text: qsTr("Title")
+                width: parent.width
                 onClicked: edit.formatLineWith('h2')
             }
             Button {
-                style: GCButtonStyle {}
-                height: 30 * ApplicationInfo.ratio
-                width: parent.width
+                style: GCButtonStyle { textSize: "subtitle"}
                 text: qsTr("Subtitle")
+                width: parent.width
                 onClicked: edit.formatLineWith('h3')
             }
             Button {
-                style: GCButtonStyle {}
-                height: 30 * ApplicationInfo.ratio
+                style: GCButtonStyle { textSize: "regular"}
                 width: parent.width
                 text: qsTr("Paragraph")
                 onClicked: edit.formatLineWith('p')
diff --git a/src/core/GCButtonStyle.qml b/src/core/GCButtonStyle.qml
index acb2156..e9a9bc7 100644
--- a/src/core/GCButtonStyle.qml
+++ b/src/core/GCButtonStyle.qml
@@ -76,6 +76,23 @@ ButtonStyle {
         }
     }
 =

+    property string textSize: "regular"
+    =

+    property variant textSizes: {
+        "regular": {
+            fontSize: 14,
+            fontBold: false
+        },
+        "subtitle": {
+            fontSize: 16,
+            fontBold: true
+        },
+        "title": {
+            fontSize: 24,
+            fontBold: true
+        }
+    }
+    =

     background: Rectangle {
         border.width: control.activeFocus ? 4 : 2
         border.color: themes[theme].borderColor
@@ -95,7 +112,8 @@ ButtonStyle {
             id: labelText
             color: themes[theme].textColor
             text: control.text
-            fontSize: regularSize
+            fontSize: textSizes[textSize].fontSize
+            font.bold: textSizes[textSize].fontBold
             anchors.verticalCenter: parent.verticalCenter
             anchors.horizontalCenter: parent.horizontalCenter
             wrapMode: Text.WordWrap

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

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