matrixion/src/InviteeItem.cpp

38 lines
1.1 KiB
C++
Raw Normal View History

2017-12-11 00:59:50 +03:00
#include <QHBoxLayout>
#include "InviteeItem.h"
2018-07-17 16:37:25 +03:00
#include "ui/FlatButton.h"
#include "ui/Theme.h"
2017-12-11 00:59:50 +03:00
constexpr int SidePadding = 10;
constexpr int IconSize = 13;
InviteeItem::InviteeItem(mtx::identifiers::User user, QWidget *parent)
: QWidget{parent}
2018-03-18 12:05:39 +03:00
, user_{QString::fromStdString(user.to_string())}
2017-12-11 00:59:50 +03:00
{
auto topLayout_ = new QHBoxLayout(this);
topLayout_->setSpacing(0);
topLayout_->setContentsMargins(SidePadding, 0, 3 * SidePadding, 0);
QFont font;
font.setPixelSize(15);
name_ = new QLabel(user_, this);
name_->setFont(font);
QIcon removeUserIcon;
removeUserIcon.addFile(":/icons/icons/ui/remove-symbol.png");
removeUserBtn_ = new FlatButton(this);
removeUserBtn_->setIcon(removeUserIcon);
removeUserBtn_->setIconSize(QSize(IconSize, IconSize));
removeUserBtn_->setFixedSize(QSize(IconSize, IconSize));
removeUserBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
topLayout_->addWidget(name_);
topLayout_->addWidget(removeUserBtn_);
connect(removeUserBtn_, &FlatButton::clicked, this, &InviteeItem::removeItem);
}