summaryrefslogtreecommitdiff
path: root/src/settings/helpers.hpp
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-08-19 21:20:26 +0300
committeraqua <aqua@iserlohn-fortress.net>2022-08-28 09:47:51 +0300
commitaae82179bc5f04b4361c57f9a1073ff3af6899c4 (patch)
tree7c5728b70c74497e50c9d078f09f2ec742c6dd50 /src/settings/helpers.hpp
parentAdd parseCommandLine tests (diff)
downloadrekonq-aae82179bc5f04b4361c57f9a1073ff3af6899c4.tar.xz
Add rekonf script to generate SettingsWidgets
- generate General Settings - generate Appearance Settings - removed previous settings widgets
Diffstat (limited to 'src/settings/helpers.hpp')
-rw-r--r--src/settings/helpers.hpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/settings/helpers.hpp b/src/settings/helpers.hpp
new file mode 100644
index 00000000..d7fcda4f
--- /dev/null
+++ b/src/settings/helpers.hpp
@@ -0,0 +1,60 @@
+/* ============================================================
+ * The rekonq project
+ * ============================================================
+ * SPDX-License-Identifier: GPL-3.0-only
+ * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
+ * ============================================================
+ * Description: Settings helpers
+ * ============================================================ */
+
+#pragma once
+
+#include <QFont>
+#include <QFontDatabase>
+
+[[nodiscard]] static QFont getFont(QFont::StyleHint hint)
+{
+ switch (hint) {
+ case QFont::Helvetica: { // sans serif
+ QFont font("sans serif");
+ font.setStyleHint(hint);
+ return font;
+ }
+ case QFont::Times: { // serif
+ QFont font("serif");
+ font.setStyleHint(hint);
+ return font;
+ }
+
+ case QFont::Monospace:
+ case QFont::Courier: { // typewriter
+ auto font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
+ font.setStyleHint(hint);
+ return font;
+ }
+
+ case QFont::OldEnglish: { // decorative
+ auto font = QFont("decorative");
+ font.setStyleHint(hint);
+ return font;
+ }
+
+ case QFont::System:
+ case QFont::AnyStyle:
+ return QFontDatabase::systemFont(QFontDatabase::GeneralFont);
+
+ case QFont::Cursive: {
+ QFont font("cursive");
+ font.setStyleHint(hint);
+ return font;
+ }
+
+ case QFont::Fantasy: {
+ QFont font("fantasy");
+ font.setStyleHint(hint);
+ return font;
+ }
+ }
+
+ __builtin_unreachable();
+}