From 43d2ebc0958d364ff24ae70920a3edeef7d0ce72 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 5 Jun 2020 23:34:00 +0200 Subject: [PATCH] Fix Qt5.15 issues fixes #214 --- src/LoginPage.cpp | 2 +- src/RegisterPage.cpp | 8 ++++---- src/UserSettingsPage.cpp | 10 +++++----- src/Utils.cpp | 4 ++-- src/dialogs/CreateRoom.cpp | 4 ++-- src/dialogs/ReadReceipts.cpp | 10 ++++++---- src/ui/Avatar.cpp | 1 + src/ui/InfoMessage.cpp | 1 + src/ui/Painter.h | 3 ++- 9 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp index 4ed08901..9a920d1d 100644 --- a/src/LoginPage.cpp +++ b/src/LoginPage.cpp @@ -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(); diff --git a/src/RegisterPage.cpp b/src/RegisterPage.cpp index e57961ef..b8fe93b5 100644 --- a/src/RegisterPage.cpp +++ b/src/RegisterPage.cpp @@ -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); diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 38b76404..dfd99069 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -612,22 +612,22 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge topLayout_->addWidget(versionInfo); connect(themeCombo_, - static_cast(&QComboBox::activated), + static_cast(&QComboBox::currentTextChanged), [this](const QString &text) { settings_->setTheme(text.toLower()); emit themeChanged(); }); connect(scaleFactorCombo_, - static_cast(&QComboBox::activated), + static_cast(&QComboBox::currentTextChanged), [](const QString &factor) { utils::setScaleFactor(factor.toFloat()); }); connect(fontSizeCombo_, - static_cast(&QComboBox::activated), + static_cast(&QComboBox::currentTextChanged), [this](const QString &size) { settings_->setFontSize(size.trimmed().toDouble()); }); connect(fontSelectionCombo_, - static_cast(&QComboBox::activated), + static_cast(&QComboBox::currentTextChanged), [this](const QString &family) { settings_->setFontFamily(family.trimmed()); }); connect(emojiFontSelectionCombo_, - static_cast(&QComboBox::activated), + static_cast(&QComboBox::currentTextChanged), [this](const QString &family) { settings_->setEmojiFontFamily(family.trimmed()); }); connect(trayToggle_, &Toggle::toggled, this, [this](bool disabled) { settings_->setTray(!disabled); diff --git a/src/Utils.cpp b/src/Utils.cpp index d539eac5..26ea124c 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -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 diff --git a/src/dialogs/CreateRoom.cpp b/src/dialogs/CreateRoom.cpp index 06676d3d..be5b4638 100644 --- a/src/dialogs/CreateRoom.cpp +++ b/src/dialogs/CreateRoom.cpp @@ -112,7 +112,7 @@ CreateRoom::CreateRoom(QWidget *parent) }); connect(visibilityCombo_, - static_cast(&QComboBox::activated), + static_cast(&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(&QComboBox::activated), + static_cast(&QComboBox::currentTextChanged), [this](const QString &text) { if (text == "Private Chat") { request_.preset = mtx::requests::Preset::PrivateChat; diff --git a/src/dialogs/ReadReceipts.cpp b/src/dialogs/ReadReceipts.cpp index 970d9125..7dcffc28 100644 --- a/src/dialogs/ReadReceipts.cpp +++ b/src/dialogs/ReadReceipts.cpp @@ -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) diff --git a/src/ui/Avatar.cpp b/src/ui/Avatar.cpp index cb77d1a8..70ebfcf2 100644 --- a/src/ui/Avatar.cpp +++ b/src/ui/Avatar.cpp @@ -1,4 +1,5 @@ #include +#include #include #include "AvatarProvider.h" diff --git a/src/ui/InfoMessage.cpp b/src/ui/InfoMessage.cpp index 27bc0a5f..0b69564d 100644 --- a/src/ui/InfoMessage.cpp +++ b/src/ui/InfoMessage.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/src/ui/Painter.h b/src/ui/Painter.h index 4d227a5a..2bb0981b 100644 --- a/src/ui/Painter.h +++ b/src/ui/Painter.h @@ -3,6 +3,7 @@ #include #include #include +#include #include class Painter : public QPainter @@ -163,5 +164,5 @@ public: private: Painter &_painter; - QPainter::RenderHints hints_ = 0; + QPainter::RenderHints hints_ = {}; };