Add close buttons to all dialogs

remotes/origin/HEAD
Konstantinos Sideris 6 years ago
parent 2a2b52e07f
commit b0e3a7c7fa
  1. 9
      src/dialogs/MemberList.cpp
  2. 10
      src/dialogs/ReadReceipts.cpp
  3. 9
      src/dialogs/RoomSettings.cpp
  4. 9
      src/dialogs/UserProfile.cpp

@ -95,8 +95,16 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
topLabel_->setAlignment(Qt::AlignCenter);
topLabel_->setFont(font);
auto okBtn = new QPushButton("OK", this);
auto buttonLayout = new QHBoxLayout();
buttonLayout->setSpacing(15);
buttonLayout->addStretch(1);
buttonLayout->addWidget(okBtn);
layout->addWidget(topLabel_);
layout->addWidget(list_);
layout->addLayout(buttonLayout);
list_->clear();
@ -125,6 +133,7 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this);
connect(closeShortcut, &QShortcut::activated, this, &MemberList::close);
connect(okBtn, &QPushButton::clicked, this, &MemberList::close);
}
void

@ -2,6 +2,7 @@
#include <QIcon>
#include <QListWidgetItem>
#include <QPainter>
#include <QPushButton>
#include <QShortcut>
#include <QStyleOption>
#include <QTimer>
@ -119,11 +120,20 @@ ReadReceipts::ReadReceipts(QWidget *parent)
topLabel_->setAlignment(Qt::AlignCenter);
topLabel_->setFont(font);
auto okBtn = new QPushButton(tr("Close"), this);
auto buttonLayout = new QHBoxLayout();
buttonLayout->setSpacing(15);
buttonLayout->addStretch(1);
buttonLayout->addWidget(okBtn);
layout->addWidget(topLabel_);
layout->addWidget(userList_);
layout->addLayout(buttonLayout);
auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this);
connect(closeShortcut, &QShortcut::activated, this, &ReadReceipts::close);
connect(okBtn, &QPushButton::clicked, this, &ReadReceipts::close);
}
void

@ -384,6 +384,13 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
spinnerLayout->setMargin(0);
spinnerLayout->setSpacing(0);
auto okBtn = new QPushButton("OK", this);
auto buttonLayout = new QHBoxLayout();
buttonLayout->setSpacing(15);
buttonLayout->addStretch(1);
buttonLayout->addWidget(okBtn);
layout->addWidget(avatar_, Qt::AlignCenter | Qt::AlignTop);
layout->addLayout(textLayout);
layout->addLayout(btnLayout_);
@ -395,6 +402,7 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
layout->addWidget(infoLabel, Qt::AlignLeft);
layout->addLayout(roomIdLayout);
layout->addWidget(errorLabel_);
layout->addLayout(buttonLayout);
layout->addLayout(spinnerLayout);
layout->addStretch(1);
@ -422,6 +430,7 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this);
connect(closeShortcut, &QShortcut::activated, this, &RoomSettings::close);
connect(okBtn, &QPushButton::clicked, this, &RoomSettings::close);
}
void

@ -148,12 +148,20 @@ UserProfile::UserProfile(QWidget *parent)
devicesLabel_->setFont(descriptionLabelFont);
devicesLabel_->hide();
auto okBtn = new QPushButton("OK", this);
auto closeLayout = new QHBoxLayout();
closeLayout->setSpacing(15);
closeLayout->addStretch(1);
closeLayout->addWidget(okBtn);
auto vlayout = new QVBoxLayout{this};
vlayout->addWidget(avatar_);
vlayout->addLayout(textLayout);
vlayout->addLayout(btnLayout);
vlayout->addWidget(devicesLabel_, Qt::AlignLeft);
vlayout->addWidget(devices_);
vlayout->addLayout(closeLayout);
vlayout->addStretch(1);
vlayout->setAlignment(avatar_, Qt::AlignCenter | Qt::AlignTop);
@ -178,6 +186,7 @@ UserProfile::UserProfile(QWidget *parent)
auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this);
connect(closeShortcut, &QShortcut::activated, this, &UserProfile::close);
connect(okBtn, &QPushButton::clicked, this, &UserProfile::close);
}
void

Loading…
Cancel
Save