From 213ec37eecc20266105b7ce20c6e05cc01f7e8da Mon Sep 17 00:00:00 2001
From: Konstantin <djtv01@gmail.com>
Date: Fri, 13 Dec 2019 18:58:44 +0300
Subject: [PATCH] [*]item delegat contentItem [+] property padding

---
 DapComboBox.qml | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/DapComboBox.qml b/DapComboBox.qml
index bea4837..a20c912 100644
--- a/DapComboBox.qml
+++ b/DapComboBox.qml
@@ -60,6 +60,9 @@ ComboBox {
     property int bottomIndentNormal:14 * pt
     property int bottomIndentActive:bottomIndentNormal
 
+    property int paddingTopItemDelegate:8 * pt
+    property int paddingBottomItemDelegate:paddingTopItemDelegate
+
     property int heightListElement: 32 * pt
     property int intervalListElement: 10 * pt
     property int bottomIntervalListElement:intervalListElement
@@ -96,6 +99,19 @@ ComboBox {
             else return 0
         }
 
+        contentItem: Text {
+            id:textDelegateComboBox
+            anchors.fill: parent
+            anchors.topMargin: paddingTopItemDelegate
+            anchors.bottomMargin: paddingBottomItemDelegate
+            anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
+            font.family: fontRobotoRegular.name
+            font.pixelSize: fontSizeComboBox
+            text: {if(index != currentIndex) return modelData;}
+            color: hovered ? hilightColorText : normalColorText
+        }
+
+
         //Indent from the bottom edge or the next line that will not stand out when you hover over the mouse
         //And here is the list text
         background: Rectangle {
@@ -112,17 +128,7 @@ ComboBox {
 
             color: hovered ? hilightColor : normalColor
             //the list text
-            Text {
-                        id:textDelegateComboBox
-                        anchors.fill: parent
-                      //  anchors.topMargin: 8 * pt
-                        anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
-                        verticalAlignment: Qt.AlignVCenter
-                        font.family: fontRobotoRegular.name
-                        font.pixelSize: fontSizeComboBox
-                        text: {if(index != currentIndex) return modelData;}
-                        color: hovered ? hilightColorText : normalColorText
-                    }
+
         }
         highlighted: parent.highlightedIndex === index
     }
-- 
GitLab