From d426842851e55e95d0d237a974e996a248f04c7a Mon Sep 17 00:00:00 2001 From: "tatiana.novikova" <tatiana.novikova@demlabs.net> Date: Thu, 30 Jan 2020 23:18:35 +0300 Subject: [PATCH] [+] Add external setting textRole --- widgets/DapComboBox.qml | 2 +- widgets/DapComboBoxForm.ui.qml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/widgets/DapComboBox.qml b/widgets/DapComboBox.qml index 3698dd7..1aa258e 100644 --- a/widgets/DapComboBox.qml +++ b/widgets/DapComboBox.qml @@ -44,7 +44,7 @@ DapComboBoxForm id: tm font: fontComboBox elide: Text.ElideRight - text: modelData + text: model[comboBoxTextRole] elideWidth: { if(index != currentIndex) diff --git a/widgets/DapComboBoxForm.ui.qml b/widgets/DapComboBoxForm.ui.qml index 829ec78..9c689e1 100644 --- a/widgets/DapComboBoxForm.ui.qml +++ b/widgets/DapComboBoxForm.ui.qml @@ -64,9 +64,13 @@ ComboBox ///@detalis mainLineText Text without unneccesary part. property string mainLineText + ///@detalis comboBoxTextRole The model role used for the ComboBox. + property string comboBoxTextRole: "" + width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal height: popup.visible ? heightComboBoxActive : heightComboBoxNormal anchors.verticalCenter: parent.verticalCenter + textRole: comboBoxTextRole //Icon icon near the text (arrow) indicator: -- GitLab