Fix qml warnings in NotificationsView
This commit is contained in:
@@ -58,7 +58,7 @@ QVariant NotificationsModel::data(const QModelIndex &index, int role) const
|
|||||||
QHash<int, QByteArray> NotificationsModel::roleNames() const
|
QHash<int, QByteArray> NotificationsModel::roleNames() const
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
{TextRole, "text"},
|
{TextRole, "notificationText"},
|
||||||
{RoomIdRole, "roomId"},
|
{RoomIdRole, "roomId"},
|
||||||
{AuthorName, "authorName"},
|
{AuthorName, "authorName"},
|
||||||
{AuthorAvatar, "authorAvatar"},
|
{AuthorAvatar, "authorAvatar"},
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
|
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigami.delegates as KD
|
|
||||||
import org.kde.kirigamiaddons.components as Components
|
import org.kde.kirigamiaddons.components as Components
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
@@ -41,15 +42,23 @@ Kirigami.ScrollablePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
delegate: QQC2.ItemDelegate {
|
delegate: QQC2.ItemDelegate {
|
||||||
|
id: notificationDelegate
|
||||||
|
|
||||||
|
required property string uri
|
||||||
|
required property string authorAvatar
|
||||||
|
required property string authorName
|
||||||
|
required property string roomDisplayName
|
||||||
|
required property string notificationText
|
||||||
|
|
||||||
width: parent?.width ?? 0
|
width: parent?.width ?? 0
|
||||||
|
|
||||||
onClicked: RoomManager.resolveResource(model.uri)
|
onClicked: RoomManager.resolveResource(uri)
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
Components.Avatar {
|
Components.Avatar {
|
||||||
source: model.authorAvatar
|
source: notificationDelegate.authorAvatar
|
||||||
name: model.authorName
|
name: notificationDelegate.authorName
|
||||||
implicitHeight: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
|
implicitHeight: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
|
||||||
implicitWidth: implicitHeight
|
implicitWidth: implicitHeight
|
||||||
|
|
||||||
@@ -66,7 +75,7 @@ Kirigami.ScrollablePage {
|
|||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
id: label
|
id: label
|
||||||
|
|
||||||
text: model.roomDisplayName
|
text: notificationDelegate.roomDisplayName
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font.weight: Font.Normal
|
font.weight: Font.Normal
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
@@ -78,10 +87,9 @@ Kirigami.ScrollablePage {
|
|||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
id: subtitle
|
id: subtitle
|
||||||
|
|
||||||
text: model.text
|
text: notificationDelegate.notificationText
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Kirigami.Theme.smallFont
|
font: Kirigami.Theme.smallFont
|
||||||
opacity: root.hasNotifications ? 0.9 : 0.7
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
|
|||||||
Reference in New Issue
Block a user