diff --git a/resources/qml/dialogs/InviteDialog.qml b/resources/qml/dialogs/InviteDialog.qml index 168819c4..6ee6fbf5 100644 --- a/resources/qml/dialogs/InviteDialog.qml +++ b/resources/qml/dialogs/InviteDialog.qml @@ -116,6 +116,7 @@ ApplicationWindow { spacing: Nheko.paddingMedium anchors.verticalCenter: parent.verticalCenter x: parent.x + Nheko.paddingSmall + width: del.width - Nheko.paddingSmall * 2 Avatar { width: Nheko.avatarSize @@ -148,11 +149,21 @@ ApplicationWindow { } - CursorShape { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor + Item { + Layout.fillWidth: true + Layout.fillHeight: true } + ImageButton { + image: ":/icons/icons/ui/remove-symbol.png" + onClicked: invitees.removeUser(model.mxid) + } + + } + + CursorShape { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor } } diff --git a/src/InviteesModel.cpp b/src/InviteesModel.cpp index e045581a..707bfd97 100644 --- a/src/InviteesModel.cpp +++ b/src/InviteesModel.cpp @@ -30,6 +30,20 @@ InviteesModel::addUser(QString mxid) emit countChanged(); } +void +InviteesModel::removeUser(QString mxid) +{ + for (int i = 0; i < invitees_.length(); ++i) { + if (invitees_[i]->mxid_ == mxid) { + beginRemoveRows(QModelIndex(), i, i); + invitees_.removeAt(i); + endRemoveRows(); + emit countChanged(); + break; + } + } +} + QHash InviteesModel::roleNames() const { diff --git a/src/InviteesModel.h b/src/InviteesModel.h index fd64116b..65fb78d6 100644 --- a/src/InviteesModel.h +++ b/src/InviteesModel.h @@ -43,6 +43,7 @@ public: InviteesModel(QObject *parent = nullptr); Q_INVOKABLE void addUser(QString mxid); + Q_INVOKABLE void removeUser(QString mxid); QHash roleNames() const override; int rowCount(const QModelIndex & = QModelIndex()) const override