Fix Qt5.15 issues

fixes #214
This commit is contained in:
Nicolas Werner 2020-06-05 23:34:00 +02:00
parent f8903f493f
commit 43d2ebc095
9 changed files with 24 additions and 19 deletions

View File

@ -133,7 +133,7 @@ LoginPage::LoginPage(QWidget *parent)
form_layout_->addLayout(matrixidLayout_);
form_layout_->addWidget(password_input_);
form_layout_->addWidget(deviceName_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(deviceName_, Qt::AlignHCenter);
form_layout_->addLayout(serverLayout_);
button_layout_ = new QHBoxLayout();

View File

@ -107,10 +107,10 @@ RegisterPage::RegisterPage(QWidget *parent)
tr("A server that allows registration. Since matrix is decentralized, you need to first "
"find a server you can register on or host your own."));
form_layout_->addWidget(username_input_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(password_input_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(password_confirmation_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(server_input_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(username_input_, Qt::AlignHCenter);
form_layout_->addWidget(password_input_, Qt::AlignHCenter);
form_layout_->addWidget(password_confirmation_, Qt::AlignHCenter);
form_layout_->addWidget(server_input_, Qt::AlignHCenter);
button_layout_ = new QHBoxLayout();
button_layout_->setSpacing(0);

View File

@ -612,22 +612,22 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
topLayout_->addWidget(versionInfo);
connect(themeCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &text) {
settings_->setTheme(text.toLower());
emit themeChanged();
});
connect(scaleFactorCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[](const QString &factor) { utils::setScaleFactor(factor.toFloat()); });
connect(fontSizeCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &size) { settings_->setFontSize(size.trimmed().toDouble()); });
connect(fontSelectionCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &family) { settings_->setFontFamily(family.trimmed()); });
connect(emojiFontSelectionCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &family) { settings_->setEmojiFontFamily(family.trimmed()); });
connect(trayToggle_, &Toggle::toggled, this, [this](bool disabled) {
settings_->setTray(!disabled);

View File

@ -142,13 +142,13 @@ utils::descriptiveTime(const QDateTime &then)
const auto days = then.daysTo(now);
if (days == 0)
return then.time().toString(Qt::DefaultLocaleShortDate);
return QLocale::system().toString(then.time(), QLocale::ShortFormat);
else if (days < 2)
return QString(QCoreApplication::translate("descriptiveTime", "Yesterday"));
else if (days < 7)
return then.toString("dddd");
return then.date().toString(Qt::DefaultLocaleShortDate);
return QLocale::system().toString(then.date(), QLocale::ShortFormat);
}
DescInfo

View File

@ -112,7 +112,7 @@ CreateRoom::CreateRoom(QWidget *parent)
});
connect(visibilityCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &text) {
if (text == "Private") {
request_.visibility = mtx::requests::Visibility::Private;
@ -122,7 +122,7 @@ CreateRoom::CreateRoom(QWidget *parent)
});
connect(presetCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &text) {
if (text == "Private Chat") {
request_.preset = mtx::requests::Preset::PrivateChat;

View File

@ -75,15 +75,17 @@ ReceiptItem::dateFormat(const QDateTime &then) const
auto days = then.daysTo(now);
if (days == 0)
return tr("Today %1").arg(then.time().toString(Qt::DefaultLocaleShortDate));
return tr("Today %1")
.arg(QLocale::system().toString(then.time(), QLocale::ShortFormat));
else if (days < 2)
return tr("Yesterday %1").arg(then.time().toString(Qt::DefaultLocaleShortDate));
return tr("Yesterday %1")
.arg(QLocale::system().toString(then.time(), QLocale::ShortFormat));
else if (days < 7)
return QString("%1 %2")
.arg(then.toString("dddd"))
.arg(then.time().toString(Qt::DefaultLocaleShortDate));
.arg(QLocale::system().toString(then.time(), QLocale::ShortFormat));
return then.toString(Qt::DefaultLocaleShortDate);
return QLocale::system().toString(then.time(), QLocale::ShortFormat);
}
ReadReceipts::ReadReceipts(QWidget *parent)

View File

@ -1,4 +1,5 @@
#include <QPainter>
#include <QPainterPath>
#include <QSettings>
#include "AvatarProvider.h"

View File

@ -4,6 +4,7 @@
#include <QDateTime>
#include <QLocale>
#include <QPainter>
#include <QPainterPath>
#include <QPen>
#include <QtGlobal>

View File

@ -3,6 +3,7 @@
#include <QFontMetrics>
#include <QPaintDevice>
#include <QPainter>
#include <QPainterPath>
#include <QtGlobal>
class Painter : public QPainter
@ -163,5 +164,5 @@ public:
private:
Painter &_painter;
QPainter::RenderHints hints_ = 0;
QPainter::RenderHints hints_ = {};
};