From ace0f84ca38a6ea1c6d92ee1bd2573419d39d71b Mon Sep 17 00:00:00 2001
From: Konstantin <djtv01@gmail.com>
Date: Fri, 13 Dec 2019 17:14:40 +0300
Subject: [PATCH] Aligned text in list

---
 DapComboBox.qml | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/DapComboBox.qml b/DapComboBox.qml
index daf5242..bea4837 100644
--- a/DapComboBox.qml
+++ b/DapComboBox.qml
@@ -96,18 +96,8 @@ ComboBox {
             else return 0
         }
 
-        ///text of string
-        contentItem: Text {
-            id:textDelegateComboBox
-            anchors.fill: parent
-            anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
-            verticalAlignment: Qt.AlignCenter
-            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 {
             anchors.fill: parent
             anchors.bottomMargin: {
@@ -117,8 +107,22 @@ ComboBox {
                     else return intervalListElement
                 }
                 if (index == customComboBox.count - 1) return bottomIntervalListElement
+                return intervalListElement
             }
+
             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