From da62ead17cf571f038ec67b9be2d8496611358a8 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Thu, 23 Jan 2020 15:57:54 -0400 Subject: [PATCH] Custom combo box was not using our own custom font. As a result, it would respect neither the font family nor font size accordingly. --- src/QmlControls/QGCComboBox.qml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/QmlControls/QGCComboBox.qml b/src/QmlControls/QGCComboBox.qml index b46a8c377..433d25a71 100644 --- a/src/QmlControls/QGCComboBox.qml +++ b/src/QmlControls/QGCComboBox.qml @@ -21,6 +21,8 @@ T.ComboBox { id: control padding: ScreenTools.comboBoxPadding spacing: ScreenTools.defaultFontPixelWidth + font.pointSize: ScreenTools.defaultFontPointSize + font.family: ScreenTools.normalFontFamily implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding + padding) implicitHeight: Math.max(background ? background.implicitHeight : 0, @@ -37,13 +39,13 @@ T.ComboBox { property real _popupWidth: sizeToContents ? _largestTextWidth + leftPadding + rightPadding : control.width TextMetrics { - id: textMetrics + id: textMetrics + font: control.font } onModelChanged: { if (sizeToContents) { _largestTextWidth = 0 - textMetrics.font = control.font for (var i = 0; i < model.length; i++){ textMetrics.text = model[i] _largestTextWidth = Math.max(textMetrics.width, _largestTextWidth) @@ -59,8 +61,9 @@ T.ComboBox { property string _text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData TextMetrics { - id: popupItemMetrics - text: _text + id: popupItemMetrics + font: control.font + text: _text } contentItem: Text { -- 2.22.0