[vlc-commits] qml: set height of TransparentSpinBox based on fontHeight

Prince Gupta git at videolan.org
Mon Nov 23 15:37:11 CET 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Wed Nov 18 01:10:50 2020 +0530| [29ddfb04c310312544037c9726b54d7f845e454a] | committer: Pierre Lamot

qml: set height of TransparentSpinBox based on fontHeight

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=29ddfb04c310312544037c9726b54d7f845e454a
---

 modules/gui/qt/player/qml/LanguageMenu.qml        |  8 --------
 modules/gui/qt/widgets/qml/TransparentSpinBox.qml | 15 ++++++++-------
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/modules/gui/qt/player/qml/LanguageMenu.qml b/modules/gui/qt/player/qml/LanguageMenu.qml
index 8181b0c199..3b8cf47272 100644
--- a/modules/gui/qt/player/qml/LanguageMenu.qml
+++ b/modules/gui/qt/player/qml/LanguageMenu.qml
@@ -401,7 +401,6 @@ T.Menu {
 
                         property bool inhibitUpdate: true
 
-                        padding: VLCStyle.margin_xxxsmall
                         textFromValue: function (value, locale) {
                             return i18n.qtr("%1 ms").arg(
                                         Number(value).toLocaleString(locale,
@@ -416,7 +415,6 @@ T.Menu {
                         from: -10000
 
                         Layout.preferredWidth: VLCStyle.dp(128, VLCStyle.scale)
-                        Layout.preferredHeight: VLCStyle.dp(27, VLCStyle.scale)
 
                         onValueChanged: {
                             if (inhibitUpdate)
@@ -476,14 +474,12 @@ T.Menu {
 
                         property bool inhibitUpdate: true
 
-                        padding: VLCStyle.margin_xxxsmall
                         textFromValue: audioDelaySpin.textFromValue
                         valueFromText: audioDelaySpin.valueFromText
                         stepSize: 50
                         from: -10000
 
                         Layout.preferredWidth: VLCStyle.dp(128, VLCStyle.scale)
-                        Layout.preferredHeight: VLCStyle.dp(27, VLCStyle.scale)
 
                         onValueChanged: {
                             if (inhibitUpdate)
@@ -538,14 +534,12 @@ T.Menu {
 
                         property bool inhibitUpdate: true
 
-                        padding: VLCStyle.margin_xxxsmall
                         textFromValue: primarySubSpin.textFromValue
                         valueFromText: primarySubSpin.valueFromText
                         stepSize: 50
                         from: -10000
 
                         Layout.preferredWidth: VLCStyle.dp(128, VLCStyle.scale)
-                        Layout.preferredHeight: VLCStyle.dp(27, VLCStyle.scale)
 
                         onValueChanged: {
                             if (inhibitUpdate)
@@ -655,7 +649,6 @@ T.Menu {
 
                         property bool inhibitUpdate: true
 
-                        padding: VLCStyle.margin_xxxsmall
                         stepSize: 1
                         textFromValue: function (value, locale) {
                             return i18n.qtr("%1 fps").arg(
@@ -669,7 +662,6 @@ T.Menu {
                         }
 
                         Layout.preferredWidth: VLCStyle.dp(128, VLCStyle.scale)
-                        Layout.preferredHeight: VLCStyle.dp(27, VLCStyle.scale)
 
                         onValueChanged: {
                             if (inhibitUpdate)
diff --git a/modules/gui/qt/widgets/qml/TransparentSpinBox.qml b/modules/gui/qt/widgets/qml/TransparentSpinBox.qml
index 45476e31ec..2a799a16bb 100644
--- a/modules/gui/qt/widgets/qml/TransparentSpinBox.qml
+++ b/modules/gui/qt/widgets/qml/TransparentSpinBox.qml
@@ -35,9 +35,11 @@ T.SpinBox {
     editable: true
     from: 0
     to: 99999
+    padding: VLCStyle.dp(6, VLCStyle.scale)
     font.pixelSize: VLCStyle.fontSize_normal
+    implicitHeight: VLCStyle.fontHeight_normal + control.topPadding + control.bottomPadding
 
-    contentItem: TextField {
+    contentItem: TextInput {
         z: 2
         text: control.textFromValue(control.value, control.locale)
         color: control.color
@@ -47,13 +49,10 @@ T.SpinBox {
         readOnly: !control.editable
         validator: control.validator
         inputMethodHints: Qt.ImhFormattedNumbersOnly
-
-        background: Item {}
+        padding: 0
     }
 
     background: Rectangle {
-        implicitHeight: VLCStyle.dp(28, VLCStyle.scale)
-        implicitWidth: VLCStyle.dp(128, VLCStyle.scale)
         color: "transparent"
         border.width: control.borderWidth
         border.color: control.borderColor
@@ -69,7 +68,8 @@ T.SpinBox {
         color: !control.up.pressed ? control.color : VLCStyle.colors.accent
         horizontalAlignment: Text.AlignHCenter
         verticalAlignment: Text.AlignVCenter
-        padding: VLCStyle.margin_xsmall
+        leftPadding: control.leftPadding
+        rightPadding: control.rightPadding
 
         MouseArea {
             anchors.fill: parent
@@ -96,7 +96,8 @@ T.SpinBox {
         color: !control.down.pressed ? control.color : VLCStyle.colors.accent
         horizontalAlignment: Text.AlignHCenter
         verticalAlignment: Text.AlignVCenter
-        padding: VLCStyle.margin_xsmall
+        leftPadding: control.leftPadding
+        rightPadding: control.rightPadding
 
         MouseArea {
             anchors.fill: parent



More information about the vlc-commits mailing list