commit c2839ced65a8402c10f8d80a5a25a316f507f47d
Author: Koji Yokota <[email protected]>
Date:   Mon Jul 14 17:10:57 2025 +0900

    Improve dialogs of color preference
---
 src/frontends/qt/GuiPrefs.cpp       | 16 +++++++--
 src/frontends/qt/ui/PrefColorsUi.ui | 67 +++++++++++++++++++------------------
 2 files changed, 49 insertions(+), 34 deletions(-)

diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 9dce8e0f64..82e41bf716 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1971,8 +1971,20 @@ void PrefColors::clearFilter() {
 void PrefColors::openColorChooser()
 {
        QColorDialog cdlg(form_);
-       QColor color = cdlg.getColor();
-       filterByColor(color);
+       QColor initial_color = Qt::white;
+
+       if (!selected_indexes_.empty()) {
+               if (!guiApp->colorCache().isDarkMode())
+                       initial_color = 
theme_colors_[selected_indexes_.first().row()].first;
+               else
+                       initial_color = 
theme_colors_[selected_indexes_.first().row()].second;
+       }
+
+       // open color dialog
+       QColor color = cdlg.getColor(initial_color, form_);
+
+       if (color.isValid())
+               filterByColor(color);
 }
 
 
diff --git a/src/frontends/qt/ui/PrefColorsUi.ui 
b/src/frontends/qt/ui/PrefColorsUi.ui
index e34b317192..6d85286d12 100644
--- a/src/frontends/qt/ui/PrefColorsUi.ui
+++ b/src/frontends/qt/ui/PrefColorsUi.ui
@@ -329,6 +329,36 @@
          <property name="spacing">
           <number>0</number>
          </property>
+         <item row="1" column="4">
+          <spacer name="horizontalSpacerRight">
+           <property name="orientation">
+            <enum>Qt::Orientation::Horizontal</enum>
+           </property>
+           <property name="sizeType">
+            <enum>QSizePolicy::Policy::Fixed</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>8</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item row="1" column="5">
+          <widget class="QToolButton" name="clearFilterPB">
+           <property name="text">
+            <string>Clea&amp;r[[colorPrefDialog]]</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="3">
+          <widget class="QToolButton" name="colorChooserPB">
+           <property name="text">
+            <string>&amp;by color</string>
+           </property>
+          </widget>
+         </item>
          <item row="1" column="2">
           <widget class="QLineEdit" name="searchStringEdit">
            <property name="sizePolicy">
@@ -365,33 +395,6 @@
            </property>
           </widget>
          </item>
-         <item row="1" column="1">
-          <spacer name="horizontalSpacerButtomLeft">
-           <property name="orientation">
-            <enum>Qt::Orientation::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>6</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item row="1" column="5">
-          <widget class="QToolButton" name="clearFilterPB">
-           <property name="text">
-            <string>Clea&amp;r[[colorPrefDialog]]</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="3">
-          <widget class="QToolButton" name="colorChooserPB">
-           <property name="text">
-            <string>&amp;by color</string>
-           </property>
-          </widget>
-         </item>
          <item row="1" column="0">
           <widget class="QLabel" name="labelFilter">
            <property name="sizePolicy">
@@ -413,8 +416,8 @@
            </property>
           </widget>
          </item>
-         <item row="1" column="4">
-          <spacer name="horizontalSpacerRight">
+         <item row="1" column="1">
+          <spacer name="horizontalSpacerButtomLeft">
            <property name="orientation">
             <enum>Qt::Orientation::Horizontal</enum>
            </property>
@@ -423,7 +426,7 @@
            </property>
            <property name="sizeHint" stdset="0">
             <size>
-             <width>6</width>
+             <width>4</width>
              <height>20</height>
             </size>
            </property>
@@ -447,11 +450,11 @@
           <enum>Qt::Orientation::Horizontal</enum>
          </property>
          <property name="sizeType">
-          <enum>QSizePolicy::Policy::Preferred</enum>
+          <enum>QSizePolicy::Policy::Expanding</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
-           <width>40</width>
+           <width>8</width>
            <height>20</height>
           </size>
          </property>
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to