Increase the minimum modal size

This commit is contained in:
Konstantinos Sideris 2018-08-11 17:55:44 +03:00
parent aa2f6ce77d
commit 05547086fb
4 changed files with 25 additions and 9 deletions

View file

@ -332,8 +332,7 @@ MainWindow::openMemberListDialog(const QString &room_id)
{ {
const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : ""; const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : "";
modal_->setWidget(new dialogs::MemberList(roomToSearch, this)); showTransparentOverlayModal(new dialogs::MemberList(roomToSearch, this));
modal_->show();
} }
void void

View file

@ -16,8 +16,13 @@ using namespace dialogs;
CreateRoom::CreateRoom(QWidget *parent) CreateRoom::CreateRoom(QWidget *parent)
: QFrame(parent) : QFrame(parent)
{ {
setMinimumSize(conf::modals::MIN_WIDGET_WIDTH, conf::modals::MIN_WIDGET_HEIGHT); QFont doubleFont;
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
setMinimumHeight(conf::modals::MIN_WIDGET_HEIGHT);
setMinimumWidth(QFontMetrics(doubleFont).averageCharWidth() * 30 -
2 * conf::modals::WIDGET_MARGIN);
auto layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
layout->setSpacing(conf::modals::WIDGET_SPACING); layout->setSpacing(conf::modals::WIDGET_SPACING);

View file

@ -55,9 +55,6 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
: QFrame(parent) : QFrame(parent)
, room_id_{room_id} , room_id_{room_id}
{ {
setMinimumSize(conf::modals::MIN_WIDGET_WIDTH, conf::modals::MIN_WIDGET_HEIGHT);
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
auto layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
@ -70,6 +67,15 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
list_->setAttribute(Qt::WA_MacShowFocusRect, 0); list_->setAttribute(Qt::WA_MacShowFocusRect, 0);
list_->setSpacing(5); list_->setSpacing(5);
QFont doubleFont;
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
setMinimumHeight(list_->sizeHint().height() * 2);
setMinimumWidth(std::max(list_->sizeHint().width() + 4 * conf::modals::WIDGET_MARGIN,
QFontMetrics(doubleFont).averageCharWidth() * 30 -
2 * conf::modals::WIDGET_MARGIN));
QFont font; QFont font;
font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO); font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);

View file

@ -79,9 +79,6 @@ ReceiptItem::dateFormat(const QDateTime &then) const
ReadReceipts::ReadReceipts(QWidget *parent) ReadReceipts::ReadReceipts(QWidget *parent)
: QFrame(parent) : QFrame(parent)
{ {
setMinimumSize(conf::modals::MIN_WIDGET_WIDTH, conf::modals::MIN_WIDGET_HEIGHT);
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
auto layout = new QVBoxLayout(this); auto layout = new QVBoxLayout(this);
layout->setSpacing(conf::modals::WIDGET_SPACING); layout->setSpacing(conf::modals::WIDGET_SPACING);
layout->setMargin(conf::modals::WIDGET_MARGIN); layout->setMargin(conf::modals::WIDGET_MARGIN);
@ -92,6 +89,15 @@ ReadReceipts::ReadReceipts(QWidget *parent)
userList_->setAttribute(Qt::WA_MacShowFocusRect, 0); userList_->setAttribute(Qt::WA_MacShowFocusRect, 0);
userList_->setSpacing(conf::modals::TEXT_SPACING); userList_->setSpacing(conf::modals::TEXT_SPACING);
QFont doubleFont;
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
setMinimumHeight(userList_->sizeHint().height() * 2);
setMinimumWidth(std::max(userList_->sizeHint().width() + 4 * conf::modals::WIDGET_MARGIN,
QFontMetrics(doubleFont).averageCharWidth() * 30 -
2 * conf::modals::WIDGET_MARGIN));
QFont font; QFont font;
font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO); font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);