From fb60d019b66db021ae4a5185f26952de5bd473dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Thu, 20 Apr 2023 15:29:14 +0200 Subject: [PATCH] chore(StatusItemDelegate): api extended, internals improved Id removed from StatusBaseText used in default contentItem, what was causing that default contentItem was instantiated even when overridden by user. Radius and cursorShape properties exposed. --- .../StatusQ/Controls/StatusItemDelegate.qml | 23 +++++++++++-------- .../panels/communities/TokenHoldersPanel.qml | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusItemDelegate.qml b/ui/StatusQ/src/StatusQ/Controls/StatusItemDelegate.qml index 9fb485d3d5..63088e0a89 100644 --- a/ui/StatusQ/src/StatusQ/Controls/StatusItemDelegate.qml +++ b/ui/StatusQ/src/StatusQ/Controls/StatusItemDelegate.qml @@ -1,15 +1,16 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.Layouts 1.14 +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 import StatusQ.Core 0.1 import StatusQ.Core.Theme 0.1 -import StatusQ.Controls 0.1 ItemDelegate { id: root - property alias textHorizontalAligment: textItem.horizontalAlignment + property bool centerTextHorizontally: false + property int radius: 0 + property int cursorShape: Qt.PointingHandCursor padding: 8 spacing: 8 @@ -30,15 +31,18 @@ ItemDelegate { } StatusBaseText { - id: textItem Layout.fillWidth: true Layout.fillHeight: true font: root.font text: root.text - horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter elide: Text.ElideRight color: root.enabled ? Theme.palette.directColor1 : Theme.palette.baseColor1 + + Binding on horizontalAlignment { + when: root.centerTextHorizontally + value: Text.AlignHCenter + } } } @@ -47,11 +51,12 @@ ItemDelegate { ? Theme.palette.statusMenu.hoverBackgroundColor : "transparent" + radius: root.radius + MouseArea { anchors.fill: parent - cursorShape: Qt.PointingHandCursor + cursorShape: root.cursorShape acceptedButtons: Qt.NoButton - enabled: root.enabled } } } diff --git a/ui/app/AppLayouts/Chat/panels/communities/TokenHoldersPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/TokenHoldersPanel.qml index a1cedb933d..13b94e7aac 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/TokenHoldersPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/TokenHoldersPanel.qml @@ -111,7 +111,7 @@ Control { type: StatusComboBox.Type.Secondary delegate: StatusItemDelegate { width: combo.control.width - textHorizontalAligment: Text.AlignHCenter + centerTextHorizontally: true highlighted: combo.control.highlightedIndex === index font: combo.control.font text: Number(modelData) + 1