mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Fix crash on unfinished animation & center the edit modal
This commit is contained in:
parent
b19a5f6f8f
commit
4ab42c68f4
2 changed files with 11 additions and 0 deletions
|
@ -145,6 +145,9 @@ utils::event_body(const mtx::events::collections::TimelineEvents &event)
|
||||||
QPixmap
|
QPixmap
|
||||||
utils::scaleImageToPixmap(const QImage &img, int size)
|
utils::scaleImageToPixmap(const QImage &img, int size)
|
||||||
{
|
{
|
||||||
|
if (img.isNull())
|
||||||
|
return QPixmap();
|
||||||
|
|
||||||
const int sz = QApplication::desktop()->screen()->devicePixelRatio() * size;
|
const int sz = QApplication::desktop()->screen()->devicePixelRatio() * size;
|
||||||
return QPixmap::fromImage(
|
return QPixmap::fromImage(
|
||||||
img.scaled(sz, sz, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
img.scaled(sz, sz, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
#include "MatrixClient.h"
|
#include "MatrixClient.h"
|
||||||
#include "Painter.h"
|
#include "Painter.h"
|
||||||
#include "TextField.h"
|
#include "TextField.h"
|
||||||
|
#include "Theme.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "dialogs/RoomSettings.hpp"
|
#include "dialogs/RoomSettings.hpp"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -33,8 +35,10 @@ EditModal::EditModal(const QString &roomId, QWidget *parent)
|
||||||
|
|
||||||
applyBtn_ = new FlatButton(tr("APPLY"), this);
|
applyBtn_ = new FlatButton(tr("APPLY"), this);
|
||||||
applyBtn_->setFontSize(conf::btn::fontSize);
|
applyBtn_->setFontSize(conf::btn::fontSize);
|
||||||
|
applyBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
|
||||||
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
|
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
|
||||||
cancelBtn_->setFontSize(conf::btn::fontSize);
|
cancelBtn_->setFontSize(conf::btn::fontSize);
|
||||||
|
cancelBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
|
||||||
|
|
||||||
auto btnLayout = new QHBoxLayout;
|
auto btnLayout = new QHBoxLayout;
|
||||||
btnLayout->setContentsMargins(5, 20, 5, 5);
|
btnLayout->setContentsMargins(5, 20, 5, 5);
|
||||||
|
@ -131,6 +135,10 @@ EditModal::EditModal(const QString &roomId, QWidget *parent)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(cancelBtn_, &QPushButton::clicked, this, &EditModal::close);
|
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
|
void
|
||||||
|
|
Loading…
Reference in a new issue