]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt/GuiPrefs.cpp
Allow compiling with Qt6
[features.git] / src / frontends / qt / GuiPrefs.cpp
index f0ccb5230816c3861632ac429ee2867a5817e7f3..7537ead04820af5627a2931f0ab8eb1347082d05 100644 (file)
@@ -188,7 +188,11 @@ QString browseRelToSub(QString const & filename, QString const & relpath,
                toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath)));
 
        QString testname = reloutname;
+#if QT_VERSION < 0x060000
        testname.remove(QRegExp("^(\\.\\./)+"));
+#else
+       testname.remove(QRegularExpression("^(\\.\\./)+"));
+#endif
 
        if (testname.contains("/"))
                return outname;
@@ -1251,7 +1255,8 @@ bool PrefColors::isDefaultColor(int const row, QString const & color)
 QColor PrefColors::getDefaultColorByRow(int const row)
 {
        ColorSet const defaultcolor;
-       return defaultcolor.getX11HexName(lcolors_[size_t(row)]).c_str();
+       return defaultcolor.getX11HexName(lcolors_[size_t(row)],
+                       guiApp->colorCache().isDarkMode()).c_str();
 }
 
 
@@ -2423,7 +2428,11 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
        startCommandED->setValidator(new NoNewLineValidator(startCommandED));
        endCommandED->setValidator(new NoNewLineValidator(endCommandED));
 
+#if QT_VERSION < 0x060000
        defaultDecimalSepED->setValidator(new QRegExpValidator(QRegExp("\\S"), this));
+#else
+       defaultDecimalSepED->setValidator(new QRegularExpressionValidator(QRegularExpression("\\S"), this));
+#endif
        defaultDecimalSepED->setMaxLength(1);
 
        defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM);
@@ -2452,6 +2461,9 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
                                      index.data(Qt::UserRole).toString());
        }
        uiLanguageCO->blockSignals(false);
+
+       // FIXME: restore this when it works (see discussion in #6450).
+       respectOSkbdCB->hide();
 }
 
 
@@ -2580,9 +2592,12 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
        iconSetCO->addItem(qt_("Classic"), "classic");
        iconSetCO->addItem(qt_("Oxygen"), "oxygen");
 
-#if (!(defined Q_WS_X11 || defined(QPA_XCB)) || QT_VERSION < 0x040600)
-       useSystemThemeIconsCB->hide();
+#if QT_VERSION >= 0x040600
+       if (guiApp->platformName() != "qt4x11"
+           && guiApp->platformName() != "xcb"
+           && !guiApp->platformName().contains("wayland"))
 #endif
+               useSystemThemeIconsCB->hide();
 }
 
 
@@ -3686,9 +3701,6 @@ QString GuiPreferences::browse(QString const & file,
 }
 
 
-Dialog * createGuiPreferences(GuiView & lv) { return new GuiPreferences(lv); }
-
-
 } // namespace frontend
 } // namespace lyx