diff --git a/resources/qml/dialogs/InviteDialog.qml b/resources/qml/dialogs/InviteDialog.qml index 168819c48c8ebff05ef205a9d18169eb516910e5..6ee6fbf5cff749147cce36041dfb14731caeff2a 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 e045581a9c658382944c861144c8a9ecb2d2151f..707bfd97e9fad2e05a0da548138e8174960e0349 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<int, QByteArray> InviteesModel::roleNames() const { diff --git a/src/InviteesModel.h b/src/InviteesModel.h index fd64116b30ba42ffc208c3214ab997870a40f922..65fb78d6b0edd3e6ca15dd114b3f989a6a397fa8 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<int, QByteArray> roleNames() const override; int rowCount(const QModelIndex & = QModelIndex()) const override