diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-06-02 00:24:26 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-06-08 22:32:07 +0200 |
commit | b518f6902e909b22e1623f96249a3ab1424ced59 (patch) | |
tree | 97fe4bdf0f2ffb1e35904c1d2111c6e566984d7c /src/UserSettingsPage.cpp | |
parent | 0ac46ea2099ac64e96a6f5b7f62802e1163b0d31 (diff) |
Make Nheko compile on Qt6
Diffstat (limited to 'src/UserSettingsPage.cpp')
-rw-r--r-- | src/UserSettingsPage.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index d5b7289c..7e7cead3 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -1585,8 +1585,6 @@ UserSettingsModel::data(const QModelIndex &index, int role) const l.push_back(QString::fromStdString(d)); return l; }; - static QFontDatabase fontDb; - switch (index.row()) { case Theme: return QStringList{ @@ -1605,9 +1603,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const i->camera().toStdString(), i->cameraResolution().toStdString())); case Font: - return fontDb.families(); + return QFontDatabase::families(); case EmojiFont: - return fontDb.families(QFontDatabase::WritingSystem::Symbol); + return QFontDatabase::families(QFontDatabase::WritingSystem::Symbol); case Ringtone: { QStringList l{ QStringLiteral("Mute"), @@ -1651,8 +1649,6 @@ UserSettingsModel::data(const QModelIndex &index, int role) const bool UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int role) { - static QFontDatabase fontDb; - auto i = UserSettings::instance(); if (role == Value) { switch (index.row()) { @@ -1677,7 +1673,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int return false; } case ScaleFactor: { - if (value.canConvert(QMetaType::Double)) { + if (value.canConvert(QMetaType::fromType<double>())) { utils::setScaleFactor(static_cast<float>(value.toDouble())); return true; } else @@ -1782,7 +1778,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int return false; } case TimelineMaxWidth: { - if (value.canConvert(QMetaType::Int)) { + if (value.canConvert(QMetaType::fromType<int>())) { i->setTimelineMaxWidth(value.toInt()); return true; } else @@ -1880,7 +1876,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int return false; } case PrivacyScreenTimeout: { - if (value.canConvert(QMetaType::Int)) { + if (value.canConvert(QMetaType::fromType<int>())) { i->setPrivacyScreenTimeout(value.toInt()); return true; } else @@ -1894,7 +1890,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int return false; } case FontSize: { - if (value.canConvert(QMetaType::Double)) { + if (value.canConvert(QMetaType::fromType<double>())) { i->setFontSize(value.toDouble()); return true; } else @@ -1902,7 +1898,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int } case Font: { if (value.userType() == QMetaType::Int) { - i->setFontFamily(fontDb.families().at(value.toInt())); + i->setFontFamily(QFontDatabase::families().at(value.toInt())); return true; } else return false; @@ -1910,7 +1906,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int case EmojiFont: { if (value.userType() == QMetaType::Int) { i->setEmojiFontFamily( - fontDb.families(QFontDatabase::WritingSystem::Symbol).at(value.toInt())); + QFontDatabase::families(QFontDatabase::WritingSystem::Symbol).at(value.toInt())); return true; } else return false; |