nheko/src/InviteeItem.cpp

29 lines
838 B
C++
Raw Normal View History

2021-03-05 00:35:15 +01:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
2017-12-10 22:59:50 +01:00
#include <QHBoxLayout>
2020-05-25 13:03:49 +02:00
#include <QLabel>
#include <QPushButton>
2017-12-10 22:59:50 +01:00
#include "InviteeItem.h"
constexpr int SidePadding = 10;
InviteeItem::InviteeItem(mtx::identifiers::User user, QWidget *parent)
: QWidget{parent}
2018-03-18 10:05:39 +01:00
, user_{QString::fromStdString(user.to_string())}
2017-12-10 22:59:50 +01:00
{
auto topLayout_ = new QHBoxLayout(this);
topLayout_->setSpacing(0);
topLayout_->setContentsMargins(SidePadding, 0, 3 * SidePadding, 0);
name_ = new QLabel(user_, this);
removeUserBtn_ = new QPushButton(tr("Remove"), this);
2017-12-10 22:59:50 +01:00
topLayout_->addWidget(name_);
topLayout_->addWidget(removeUserBtn_, 0, Qt::AlignRight);
2017-12-10 22:59:50 +01:00
connect(removeUserBtn_, &QPushButton::clicked, this, &InviteeItem::removeItem);
2017-12-10 22:59:50 +01:00
}