diff --git a/src/settings/dolphin_compactmodesettings.kcfg b/src/settings/dolphin_compactmodesettings.kcfg
index 93f9947aba..3eda1b3d7b 100644
--- a/src/settings/dolphin_compactmodesettings.kcfg
+++ b/src/settings/dolphin_compactmodesettings.kcfg
@@ -12,21 +12,8 @@
true
-
-
- QFontDatabase::systemFont(QFontDatabase::GeneralFont).family()
-
-
-
- QFontDatabase::systemFont(QFontDatabase::GeneralFont).pointSizeF()
-
-
-
- false
-
-
-
- 0
+
+ QFont()
diff --git a/src/settings/dolphin_detailsmodesettings.kcfg b/src/settings/dolphin_detailsmodesettings.kcfg
index 55a78378a1..a58a8d00b0 100644
--- a/src/settings/dolphin_detailsmodesettings.kcfg
+++ b/src/settings/dolphin_detailsmodesettings.kcfg
@@ -8,26 +8,13 @@
QFontDatabase
-
-
- QFontDatabase::systemFont(QFontDatabase::GeneralFont).family()
+
+ QFont()
true
-
-
- QFontDatabase::systemFont(QFontDatabase::GeneralFont).pointSizeF()
-
-
-
- false
-
-
-
- 0
-
KIconLoader::SizeSmall
diff --git a/src/settings/dolphin_iconsmodesettings.kcfg b/src/settings/dolphin_iconsmodesettings.kcfg
index 220dd8c427..7948af75d2 100644
--- a/src/settings/dolphin_iconsmodesettings.kcfg
+++ b/src/settings/dolphin_iconsmodesettings.kcfg
@@ -12,21 +12,8 @@
true
-
-
- QFontDatabase::systemFont(QFontDatabase::GeneralFont).family()
-
-
-
- QFontDatabase::systemFont(QFontDatabase::GeneralFont).pointSizeF()
-
-
-
- false
-
-
-
- 0
+
+ QFont()
diff --git a/src/settings/viewmodes/viewmodesettings.cpp b/src/settings/viewmodes/viewmodesettings.cpp
index 8c11bde5b3..73a91a2723 100644
--- a/src/settings/viewmodes/viewmodesettings.cpp
+++ b/src/settings/viewmodes/viewmodesettings.cpp
@@ -86,59 +86,17 @@ bool ViewModeSettings::useSystemFont() const
}, m_viewModeSettingsVariant);
}
-void ViewModeSettings::setFontFamily(const QString &fontFamily)
+void ViewModeSettings::setViewFont(const QFont &font)
{
- std::visit([&fontFamily](auto &&v) {
- v->setFontFamily(fontFamily);
+ std::visit([&font](auto &&v) {
+ v->setViewFont(font);
}, m_viewModeSettingsVariant);
}
-QString ViewModeSettings::fontFamily() const
+QFont ViewModeSettings::viewFont() const
{
return std::visit([](auto &&v) {
- return v->fontFamily();
- }, m_viewModeSettingsVariant);
-}
-
-void ViewModeSettings::setFontSize(qreal fontSize)
-{
- std::visit([fontSize](auto &&v) {
- v->setFontSize(fontSize);
- }, m_viewModeSettingsVariant);
-}
-
-qreal ViewModeSettings::fontSize() const
-{
- return std::visit([](auto &&v) {
- return v->fontSize();
- }, m_viewModeSettingsVariant);
-}
-
-void ViewModeSettings::setItalicFont(bool italic)
-{
- std::visit([italic](auto &&v) {
- v->setItalicFont(italic);
- }, m_viewModeSettingsVariant);
-}
-
-bool ViewModeSettings::italicFont() const
-{
- return std::visit([](auto &&v) {
- return v->italicFont();
- }, m_viewModeSettingsVariant);
-}
-
-void ViewModeSettings::setFontWeight(int fontWeight)
-{
- std::visit([fontWeight](auto &&v) {
- v->setFontWeight(fontWeight);
- }, m_viewModeSettingsVariant);
-}
-
-int ViewModeSettings::fontWeight() const
-{
- return std::visit([](auto &&v) {
- return v->fontWeight();
+ return v->viewFont();
}, m_viewModeSettingsVariant);
}
diff --git a/src/settings/viewmodes/viewmodesettings.h b/src/settings/viewmodes/viewmodesettings.h
index 5d2b6e0e21..6d8b3afb68 100644
--- a/src/settings/viewmodes/viewmodesettings.h
+++ b/src/settings/viewmodes/viewmodesettings.h
@@ -39,17 +39,8 @@ public:
void setUseSystemFont(bool useSystemFont);
bool useSystemFont() const;
- void setFontFamily(const QString &fontFamily);
- QString fontFamily() const;
-
- void setFontSize(qreal fontSize);
- qreal fontSize() const;
-
- void setItalicFont(bool italic);
- bool italicFont() const;
-
- void setFontWeight(int fontWeight);
- int fontWeight() const;
+ void setViewFont(const QFont &font);
+ QFont viewFont() const;
void useDefaults(bool useDefaults);
diff --git a/src/settings/viewmodes/viewsettingstab.cpp b/src/settings/viewmodes/viewsettingstab.cpp
index 1e109aab05..0448af7c04 100644
--- a/src/settings/viewmodes/viewsettingstab.cpp
+++ b/src/settings/viewmodes/viewsettingstab.cpp
@@ -215,10 +215,7 @@ void ViewSettingsTab::applySettings()
settings.setPreviewSize(previewSize);
settings.setUseSystemFont(useSystemFont);
- settings.setFontFamily(font.family());
- settings.setFontSize(font.pointSizeF());
- settings.setItalicFont(font.italic());
- settings.setFontWeight(font.weight());
+ settings.setViewFont(font);
settings.save();
}
@@ -272,10 +269,7 @@ void ViewSettingsTab::loadSettings()
? DolphinFontRequester::SystemFont
: DolphinFontRequester::CustomFont);
- QFont font(settings.fontFamily(), qRound(settings.fontSize()));
- font.setItalic(settings.italicFont());
- font.setWeight(settings.fontWeight());
- font.setPointSizeF(settings.fontSize());
+ QFont font(settings.viewFont());
m_fontRequester->setCustomFont(font);
}
diff --git a/src/views/dolphinitemlistview.cpp b/src/views/dolphinitemlistview.cpp
index 5a6987f650..d667081da3 100644
--- a/src/views/dolphinitemlistview.cpp
+++ b/src/views/dolphinitemlistview.cpp
@@ -132,10 +132,7 @@ void DolphinItemListView::updateFont()
if (settings.useSystemFont()) {
KItemListView::updateFont();
} else {
- QFont font(settings.fontFamily(), qRound(settings.fontSize()));
- font.setItalic(settings.italicFont());
- font.setWeight(settings.fontWeight());
- font.setPointSizeF(settings.fontSize());
+ QFont font(settings.viewFont());
KItemListStyleOption option = styleOption();
option.font = font;