summaryrefslogtreecommitdiffstats
path: root/src/InviteeItem.cc
blob: c544032cc5ae71751611374ebbad6858af971d1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <QHBoxLayout>

#include "FlatButton.h"
#include "InviteeItem.h"
#include "Theme.h"

constexpr int SidePadding = 10;
constexpr int IconSize    = 13;

InviteeItem::InviteeItem(mtx::identifiers::User user, QWidget *parent)
  : QWidget{parent}
  , user_{QString::fromStdString(user.toString())}
{
        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);
}