mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Add a copy button near the username in usercards
This commit is contained in:
parent
a624d14a4f
commit
f2f5ae9c93
1 changed files with 16 additions and 1 deletions
|
@ -58,11 +58,26 @@ UserInfoPopup::UserInfoPopup()
|
|||
// items on the right
|
||||
auto vbox = head.emplace<QVBoxLayout>();
|
||||
{
|
||||
auto name = vbox.emplace<Label>().assign(&this->ui_.nameLabel);
|
||||
auto name_box = vbox.emplace<QHBoxLayout>();
|
||||
name_box.withoutMargin();
|
||||
|
||||
auto name = name_box.emplace<Label>().assign(&this->ui_.nameLabel);
|
||||
|
||||
LayoutCreator<EffectLabel2> copy_user_name = name_box.emplace<EffectLabel2>(this);
|
||||
copy_user_name->getLabel().setText("Copy");
|
||||
copy_user_name->getLabel().setCentered(true);
|
||||
|
||||
auto font = name->font();
|
||||
font.setBold(true);
|
||||
name->setFont(font);
|
||||
|
||||
name_box->addStretch(1);
|
||||
|
||||
QObject::connect(copy_user_name.getElement(), &Button::leftClicked, [this] {
|
||||
QClipboard *clipboard = QGuiApplication::clipboard();
|
||||
clipboard->setText(this->userName_);
|
||||
});
|
||||
|
||||
vbox.emplace<Label>(TEXT_VIEWS).assign(&this->ui_.viewCountLabel);
|
||||
vbox.emplace<Label>(TEXT_FOLLOWERS)
|
||||
.assign(&this->ui_.followerCountLabel);
|
||||
|
|
Loading…
Reference in a new issue