Skip to content
Snippets Groups Projects
Commit 4ab42c68 authored by Konstantinos Sideris's avatar Konstantinos Sideris
Browse files

Fix crash on unfinished animation & center the edit modal

parent b19a5f6f
No related branches found
No related tags found
No related merge requests found
......@@ -145,6 +145,9 @@ utils::event_body(const mtx::events::collections::TimelineEvents &event)
QPixmap
utils::scaleImageToPixmap(const QImage &img, int size)
{
if (img.isNull())
return QPixmap();
const int sz = QApplication::desktop()->screen()->devicePixelRatio() * size;
return QPixmap::fromImage(
img.scaled(sz, sz, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
......
......@@ -4,9 +4,11 @@
#include "MatrixClient.h"
#include "Painter.h"
#include "TextField.h"
#include "Theme.h"
#include "Utils.h"
#include "dialogs/RoomSettings.hpp"
#include <QApplication>
#include <QComboBox>
#include <QLabel>
#include <QPainter>
......@@ -33,8 +35,10 @@ EditModal::EditModal(const QString &roomId, QWidget *parent)
applyBtn_ = new FlatButton(tr("APPLY"), this);
applyBtn_->setFontSize(conf::btn::fontSize);
applyBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
cancelBtn_->setFontSize(conf::btn::fontSize);
cancelBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
auto btnLayout = new QHBoxLayout;
btnLayout->setContentsMargins(5, 20, 5, 5);
......@@ -131,6 +135,10 @@ EditModal::EditModal(const QString &roomId, QWidget *parent)
}
});
connect(cancelBtn_, &QPushButton::clicked, this, &EditModal::close);
auto window = QApplication::activeWindow();
auto center = window->frameGeometry().center();
move(center.x() - (width() * 0.5), center.y() - (height() * 0.5));
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment