feat(ProfileShowcase): Implement workaround for the inline components not working

This commit will fix the linux and windows builds by removing the usage of public inline components

TODO: revert this commit once all platforms are migrated to qt 5.15.8+
This commit is contained in:
Alex Jbanca 2024-02-29 11:07:35 +02:00 committed by Alex Jbanca
parent 4a4a5d5c4b
commit e304d9b76b
8 changed files with 43 additions and 29 deletions

View File

@ -99,7 +99,7 @@ SplitView {
}
}
delegate: ProfileShowcasePanel.Delegate {
delegate: ProfileShowcasePanelDelegate {
title: model ? model.title : ""
secondaryTitle: model ? model.secondaryTitle : ""
hasImage: model ? model.hasImage : false

View File

@ -0,0 +1,30 @@
import QtQuick 2.15
import utils 1.0
// Component implementing the common ShowcaseDelegate interface needed for the ProfileShowcasePanel
// Workaround until the all plafroms support public inline components.
// Linux and windows needs to be upgraded to qt 5.15.8+
// https://bugreports.qt.io/browse/QTBUG-89180
// TODO: Revert this commit once the inline componets are supported
// Remove this file and use the inline component once all platforms are upgraded to 5.15.8+
ShowcaseDelegate {
id: root
// required property modelData
// required property dragKeysData
// required property dragParentData
// required property visualIndexData
readonly property var model: modelData
readonly property var key: model ? model.key : null
Drag.keys: dragKeysData
dragParent: dragParentData
visualIndex: visualIndexData
dragAxis: Drag.YAxis
showcaseVisibility: model ? model.visibility ?? Constants.ShowcaseVisibility.NoOne :
Constants.ShowcaseVisibility.NoOne
}

View File

@ -1,5 +1,6 @@
AddMoreAccountsLink 1.0 AddMoreAccountsLink.qml
WalletAccountDelegate 1.0 WalletAccountDelegate.qml
ProfileShowcasePanelDelegate 1.0 ProfileShowcasePanelDelegate.qml
ShowcaseDelegate 1.0 ShowcaseDelegate.qml
StaticSocialLinkInput 1.0 StaticSocialLinkInput.qml
WalletAccountDelegate 1.0 WalletAccountDelegate.qml
WalletKeyPairDelegate 1.0 WalletKeyPairDelegate.qml

View File

@ -15,7 +15,7 @@ ProfileShowcasePanel {
emptyInShowcasePlaceholderText: qsTr("Accounts here will show on your profile")
emptyHiddenPlaceholderText: qsTr("Accounts here will be hidden from your profile")
delegate: ProfileShowcasePanel.Delegate {
delegate: ProfileShowcasePanelDelegate {
title: model ? model.name : ""
secondaryTitle: WalletUtils.addressToDisplay(model ? model.key : "", "", true, containsMouse)
hasEmoji: model && !!model.emoji

View File

@ -22,7 +22,7 @@ ProfileShowcasePanel {
emptyInShowcasePlaceholderText: qsTr("Assets here will show on your profile")
emptyHiddenPlaceholderText: qsTr("Assets here will be hidden from your profile")
delegate: ProfileShowcasePanel.Delegate {
delegate: ProfileShowcasePanelDelegate {
property double totalValue: !!model && !!model.decimals ? balancesAggregator.value/(10 ** model.decimals): 0

View File

@ -21,7 +21,7 @@ ProfileShowcasePanel {
additionalFooterComponent: root.addAccountsButtonVisible ? addMoreAccountsComponent : null
delegate: ProfileShowcasePanel.Delegate {
delegate: ProfileShowcasePanelDelegate {
title: !!model ? `${model.name}` || `#${model.id}` : ""
secondaryTitle: !!model && !!model.collectionName ? model.collectionName : ""
hasImage: !!model && !!model.imageUrl

View File

@ -10,7 +10,7 @@ ProfileShowcasePanel {
emptyInShowcasePlaceholderText: qsTr("Drag communities here to display in showcase")
emptyHiddenPlaceholderText: qsTr("Communities here will be hidden from your Profile")
delegate: ProfileShowcasePanel.Delegate {
delegate: ProfileShowcasePanelDelegate {
title: model ? model.name : ""
secondaryTitle: model && (model.memberRole === Constants.memberRole.owner ||
model.memberRole === Constants.memberRole.admin ||

View File

@ -17,7 +17,7 @@ import AppLayouts.Profile.controls 1.0
DoubleFlickableWithFolding {
id: root
property Component delegate: Delegate {}
property Component delegate: ProfileShowcasePanelDelegate {}
// Expected roles:
// - visibility: int
@ -35,28 +35,6 @@ DoubleFlickableWithFolding {
// Signal to request visibility change of the items
signal setVisibilityRequested(var key, int toVisibility)
// Public delegate component. Implements the minimal ShowcaseDelegate interface needed for DND
component Delegate: ShowcaseDelegate {
id: showcaseDelegate
property var model: modelData
property var dragKeys: dragKeysData
readonly property var key: model ? model.key : null
Drag.keys: dragKeys
dragParent: dragParentData
visualIndex: visualIndexData
dragAxis: Drag.YAxis
showcaseVisibility: model ? model.visibility ?? Constants.ShowcaseVisibility.NoOne :
Constants.ShowcaseVisibility.NoOne
onShowcaseVisibilityRequested: function (toVisibility){
root.setVisibilityRequested(key, toVisibility)
}
}
ScrollBar.vertical: StatusScrollBar {
policy: ScrollBar.AsNeeded
visible: resolveVisibility(policy, root.height, root.contentHeight)
@ -357,6 +335,11 @@ DoubleFlickableWithFolding {
width: parent.width
sourceComponent: root.delegate
onItemChanged: {
if (item) {
item.showcaseVisibilityRequested.connect((toVisibility) => root.setVisibilityRequested(showcaseDelegateRoot.model.key, toVisibility))
}
}
}
Binding {