There is quite a difference in quality between different Qt user interface styles. IMO macOS gets the short stick, Windows fares a bit better, while Qt's own Fusion style is probably best.

I have created a style preference patch. It allows the user to choose a different Qt style for the user interface via Preferences > User Interface > . It's a quick and dirty patch. Nothing is saved to the preferences file. For the UI to fully adopt probably a restart of LyX is necessary (which the change currently does not survive). However, it might be enough to give an impression of what it looks like on other styles. Unfortunately, not all styles are available in every OS. For example, macOS has "macintosh", "Windows" and "Fusion". Where the "Windows" style is quite basic only indicating the look of Windows not exactly matching current Windows 10. And "macintosh" is only available on macOS, as far as I know. So, it's probably mainly a way for macOS and Windows users to try Fusion.

It could be worth shipping this as a "real" preference in LyX. But I am not sure what the costs are apart from yet another preference. Though, I still think, even if such a preference is added, LyX should take care that the native styles look good on macOS and Windows (Linux being more flexible and better supported in regards to styles).

Daniel
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 98aa0c12b8..996db9324e 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -66,6 +66,7 @@
 #include <QPushButton>
 #include <QSpinBox>
 #include <QString>
+#include <QStyleFactory>
 #include <QTreeWidget>
 #include <QTreeWidgetItem>
 #include <QValidator>
@@ -2565,6 +2566,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * 
form)
 {
        setupUi(this);
 
+       connect(styleCO, SIGNAL(activated(int)),
+               this, SIGNAL(changed()));
        connect(uiFilePB, SIGNAL(clicked()),
                this, SLOT(selectUi()));
        connect(uiFileED, SIGNAL(textChanged(QString)),
@@ -2583,6 +2586,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * 
form)
        iconSetCO->addItem(qt_("Classic"), "classic");
        iconSetCO->addItem(qt_("Oxygen"), "oxygen");
 
+       styleCO->addItems(QStyleFactory::keys());
+
 #if (!(defined Q_WS_X11 || defined(QPA_XCB)) || QT_VERSION < 0x040600)
        useSystemThemeIconsCB->hide();
 #endif
@@ -2591,6 +2596,7 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * 
form)
 
 void PrefUserInterface::applyRC(LyXRC & rc) const
 {
+       qApp->setStyle(QStyleFactory::create(styleCO->currentText()));
        rc.icon_set = fromqstr(iconSetCO->itemData(
                iconSetCO->currentIndex()).toString());
 
diff --git a/src/frontends/qt/ui/PrefUi.ui b/src/frontends/qt/ui/PrefUi.ui
index fcc1d3745c..094fc27353 100644
--- a/src/frontends/qt/ui/PrefUi.ui
+++ b/src/frontends/qt/ui/PrefUi.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>426</width>
-    <height>340</height>
+    <height>379</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -20,6 +20,19 @@
    <string/>
   </property>
   <layout class="QGridLayout" name="gridLayout_4">
+   <item row="3" column="0">
+    <spacer>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>395</width>
+       <height>16</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item row="0" column="0">
     <widget class="QGroupBox" name="groupBox">
      <property name="title">
@@ -42,7 +55,7 @@
       </item>
       <item row="0" column="0">
        <layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
-        <item row="0" column="0">
+        <item row="1" column="0">
          <widget class="QLabel" name="uiFileLA">
           <property name="text">
            <string>&amp;User interface file:</string>
@@ -52,17 +65,13 @@
           </property>
          </widget>
         </item>
-        <item row="0" column="1">
+        <item row="1" column="1">
          <widget class="QLineEdit" name="uiFileED"/>
         </item>
-        <item row="0" column="2">
-         <widget class="QPushButton" name="uiFilePB">
-          <property name="text">
-           <string>Bro&amp;wse...</string>
-          </property>
-         </widget>
+        <item row="2" column="2">
+         <layout class="QHBoxLayout" name="horizontalLayout"/>
         </item>
-        <item row="1" column="0">
+        <item row="2" column="0">
          <widget class="QLabel" name="iconSetLA">
           <property name="text">
            <string>&amp;Icon set:</string>
@@ -72,7 +81,7 @@
           </property>
          </widget>
         </item>
-        <item row="1" column="1">
+        <item row="2" column="1">
          <widget class="QComboBox" name="iconSetCO">
           <property name="toolTip">
            <string>The icon set to use. Warning: normal size of icons may be 
wrong until you save the preferences and restart LyX.</string>
@@ -80,7 +89,21 @@
          </widget>
         </item>
         <item row="1" column="2">
-         <layout class="QHBoxLayout" name="horizontalLayout"/>
+         <widget class="QPushButton" name="uiFilePB">
+          <property name="text">
+           <string>Bro&amp;wse...</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0">
+         <widget class="QLabel" name="uiStyleLA">
+          <property name="text">
+           <string>Style:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QComboBox" name="styleCO"/>
         </item>
        </layout>
       </item>
@@ -186,19 +209,6 @@
      </layout>
     </widget>
    </item>
-   <item row="3" column="0">
-    <spacer>
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>395</width>
-       <height>16</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <layoutdefault spacing="4" margin="9"/>
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to