dropdown list fixes to match design layout

This commit is contained in:
vladimir.kuznetsov 2023-08-16 22:45:05 +05:00
parent e0d6e0117e
commit a8deb3593b
12 changed files with 177 additions and 139 deletions

View file

@ -0,0 +1,70 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "TextTypes"
ListView {
id: menuContent
property var rootWidth
property var selectedText
property string imageSource: "qrc:/images/controls/check.svg"
property var clickedFunction
property bool dividerVisible: false
currentIndex: 0
width: rootWidth
height: menuContent.contentItem.height
clip: true
interactive: false
ButtonGroup {
id: buttonGroup
}
delegate: Item {
implicitWidth: rootWidth
implicitHeight: content.implicitHeight
ColumnLayout {
id: content
anchors.fill: parent
LabelWithButtonType {
Layout.fillWidth: true
text: name
rightImageSource: imageSource
clickedFunction: function() {
menuContent.currentIndex = index
menuContent.selectedText = name
if (menuContent.clickedFunction && typeof menuContent.clickedFunction === "function") {
menuContent.clickedFunction()
}
}
}
DividerType {
Layout.fillWidth: true
Layout.bottomMargin: 4
visible: dividerVisible
}
}
Component.onCompleted: {
if (menuContent.currentIndex === index) {
menuContent.selectedText = name
}
}
}
}

View file

@ -11,12 +11,10 @@ ListView {
property var selectedText
property string imageSource
property string imageSource: "qrc:/images/controls/check.svg"
property var clickedFunction
property bool dividerVisible: false
currentIndex: 0
width: rootWidth
@ -53,6 +51,12 @@ ListView {
Behavior on color {
PropertyAnimation { duration: 200 }
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
RowLayout {
@ -73,8 +77,8 @@ ListView {
}
Image {
source: imageSource ? imageSource : "qrc:/images/controls/check.svg"
visible: imageSource ? true : radioButton.checked
source: imageSource
visible: radioButton.checked
width: 24
height: 24
@ -94,13 +98,6 @@ ListView {
}
}
}
DividerType {
Layout.fillWidth: true
Layout.bottomMargin: 4
visible: dividerVisible
}
}
Component.onCompleted: {

View file

@ -28,4 +28,14 @@ Item {
root.stackView.pop()
}
}
MouseArea {
z: -1
anchors.fill: parent
onClicked: {
console.log("base mouse area pressed")
focus = true
}
}
}