TokenSelector: TokenSelectorSectionDelegate excluded to separate component

This commit is contained in:
Michał Cieślak 2024-09-10 14:38:13 +02:00 committed by Michał
parent 2a57b21761
commit 2b4c3afd57
4 changed files with 33 additions and 15 deletions

View File

@ -29,9 +29,10 @@ Control {
iconUrl [url] - chain's icon
**/
property alias model: sfpm.sourceModel
property string highlightedKey: ""
property string sectionProperty
signal selected(string key)
property string highlightedKey: ""
SortFilterProxyModel {
id: sfpm
@ -74,6 +75,13 @@ Control {
model: sfpm
section.property: root.sectionProperty
section.delegate: TokenSelectorSectionDelegate {
width: ListView.view.width
text: section
}
delegate: TokenSelectorAssetDelegate {
required property var model
required property int index

View File

@ -6,7 +6,6 @@ import QtQml.Models 2.15
import StatusQ 0.1
import StatusQ.Controls 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1
import StatusQ.Popups.Dialog 0.1
@ -124,20 +123,9 @@ Control {
}
section.property: "type"
section.delegate: StatusBaseText {
section.delegate: TokenSelectorSectionDelegate {
width: ListView.view.width
// Fixed height as a workaround for the
// https://bugreports.qt.io/browse/QTBUG-62411 bug
// causing improper first item positioning in some cases
// (overlapping with the section delegate)
height: 50
color: Theme.palette.baseColor1
padding: Style.current.padding
bottomPadding: 0
elide: Text.ElideRight
text: section === "community"
? qsTr("Community minted")
: qsTr("Other")

View File

@ -0,0 +1,21 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import utils 1.0
StatusBaseText {
// Fixed height as a workaround for the
// https://bugreports.qt.io/browse/QTBUG-62411 bug
// causing improper first item positioning in some cases
// (overlapping with the section delegate)
height: 50
color: Theme.palette.baseColor1
padding: Style.current.padding
bottomPadding: 0
elide: Text.ElideRight
}

View File

@ -5,5 +5,6 @@ NetworkSelectorView 1.0 NetworkSelectorView.qml
SavedAddresses 1.0 SavedAddresses.qml
TokenSelectorAssetDelegate 1.0 TokenSelectorAssetDelegate.qml
TokenSelectorCollectibleDelegate 1.0 TokenSelectorCollectibleDelegate.qml
TokenSelectorSectionDelegate 1.0 TokenSelectorSectionDelegate.qml
TokenSelectorView 1.0 TokenSelectorView.qml
AccountContextMenu 1.0 AccountContextMenu.qml