From 2d8909dbf9e709f9a4c5877ce594f30be924515e Mon Sep 17 00:00:00 2001
From: "littletux89@gmail.com" <littletux89@gmail.com>
Date: Thu, 26 Dec 2019 18:35:43 +0300
Subject: [PATCH] [+] Improved frontend structure.

---
 DapMenuTabWidget.qml        | 89 -------------------------------------
 DapMenuTabWidgetForm.ui.qml |  9 ++--
 2 files changed, 3 insertions(+), 95 deletions(-)

diff --git a/DapMenuTabWidget.qml b/DapMenuTabWidget.qml
index f1d1cbe..8c99320 100644
--- a/DapMenuTabWidget.qml
+++ b/DapMenuTabWidget.qml
@@ -3,96 +3,7 @@ import QtQuick.Controls 1.4
 
 DapMenuTabWidgetForm
 {
-    ///@detalis Width of the main menu bar item.
-    property int widthItemMenu: dapMenuTab.width
-    ///@detalis Height of the main menu bar item.
-    property int heightItemMenu: 60 * pt
-    ///@detalis Width of the main menu bar item icon.
-    property int widthIconItemMenu: 18 * pt
-    ///@detalis Height of the main menu bar item icon.
-    property int heightIconItemMenu: 18 * pt
-    ///@detalis Сolor of the main menu bar item in normal condition.
-    property string normalColorItemMenu: "transparent"
-    ///@detalis Сolor of the main menu bar item in the selected state.
-    property string selectColorItemMenu: "#D51F5D"
 
-    // Widget of the main menu bar item
-    Component
-    {
-        id: itemMenuTabDelegate
-    
-        Rectangle
-        {
-            id: frameItemMenu
-
-            property bool isPushed: dapMenuTab.currentIndex === index
-
-            width: widthItemMenu
-            height: heightItemMenu
-            color: normalColorItemMenu
-
-            Image
-            {
-                id: iconItem
-                anchors.left: parent.left
-                anchors.leftMargin: 24 * pt
-                anchors.verticalCenter: parent.verticalCenter
-                height: heightIconItemMenu
-                width: widthIconItemMenu
-                source: normalIcon
-            }
-
-            Text
-            {
-                id: textItem
-                anchors.verticalCenter: parent.verticalCenter
-                anchors.left: iconItem.right
-                anchors.leftMargin: 18 * pt
-                font.family: dapFontRobotoLight.name
-                font.pixelSize: 16 * pt
-                color: "#FFFFFF"
-                text: name
-            }
-
-            MouseArea
-            {
-                id: handler
-                anchors.fill: parent
-                hoverEnabled: true
-
-                onEntered:
-                {
-                    if(!frameItemMenu.isPushed)
-                    {
-                        iconItem.source = hoverIcon;
-                        textItem.font.family = dapFontRobotoRegular.name;
-                    }
-                }
-
-                onExited:
-                {
-                    if(!frameItemMenu.isPushed)
-                    {
-                        iconItem.source = normalIcon
-                        textItem.font.family = dapFontRobotoLight.name;
-                    }
-                }
-
-                onClicked:
-                {
-                    dapMenuTab.currentIndex = index;
-                    pathScreen = page;
-                }
-            }
-
-            onIsPushedChanged:
-            {
-                frameItemMenu.color = (isPushed ?  selectColorItemMenu : normalColorItemMenu);
-                iconItem.source = isPushed ? model.hoverIcon : model.normalIcon;
-                textItem.font.family = (isPushed ? dapFontRobotoRegular.name : dapFontRobotoLight.name);
-            }
-        }
-    }
 }
 
 /*##^## Designer {
diff --git a/DapMenuTabWidgetForm.ui.qml b/DapMenuTabWidgetForm.ui.qml
index 8833e10..614ce06 100644
--- a/DapMenuTabWidgetForm.ui.qml
+++ b/DapMenuTabWidgetForm.ui.qml
@@ -12,7 +12,7 @@ Rectangle
     ///@detalis Main menu panel widget frame.
     property alias dapFrameMenuTab: frameMenuTab
     ///@detalis Main menu bar widget.
-    property alias dapMenuTab: menuTab
+    property ListView dapMenuWidget
     ///@detalis Path to the selected tab.
     property string pathScreen
 
@@ -20,13 +20,10 @@ Rectangle
     focus: true
 
     // Install the widget of the main menu panel
-    ListView
+    Item
     {
         id: menuTab
+        data: dapMenuWidget
         anchors.fill: parent
-        delegate: itemMenuTabDelegate
-        spacing: 3 * pt
-        clip: true
-        interactive: false
     }
 }
-- 
GitLab