commit 262bac334eb518b1ac8963482a2eb2cc20027076
Author: Koji Yokota <yok...@lyx.org>
Date:   Wed Jun 11 00:20:23 2025 +0900

    Further availability fix of color edit buttons in PrefColors
---
 src/frontends/qt/GuiPrefs.cpp | 11 +++++++----
 src/frontends/qt/GuiPrefs.h   |  4 ++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 413e49dca0..b911b7d9da 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1129,7 +1129,7 @@ void PrefColors::clickedColorsTV(const QModelIndex index)
        if (column < 2)
                changeColor(row, column);
 
-       enableEditButtons();
+       setEditButtonStatus();
        setResetButtonStatus(row);
 }
 
@@ -1395,12 +1395,15 @@ void PrefColors::setResetButtonStatus(bool is_undoing)
 }
 
 
-void PrefColors::enableEditButtons()
+void PrefColors::setEditButtonStatus()
 {
-       if (!lightColorEditPB->isEnabled())
+       if (selection_model_.hasSelection()) {
                lightColorEditPB->setEnabled(true);
-       if (!darkColorEditPB->isEnabled())
                darkColorEditPB->setEnabled(true);
+       } else {
+               lightColorEditPB->setEnabled(false);
+               darkColorEditPB->setEnabled(false);
+       }
 }
 
 
diff --git a/src/frontends/qt/GuiPrefs.h b/src/frontends/qt/GuiPrefs.h
index 362da3d550..e23d20cdf6 100644
--- a/src/frontends/qt/GuiPrefs.h
+++ b/src/frontends/qt/GuiPrefs.h
@@ -308,8 +308,8 @@ private:
        void setResetButtonStatus(int const &row, bool is_undoing = false);
        /// Set availability of reset buttons of the selected row
        void setResetButtonStatus(bool is_undoing = false);
-       /// Enable edit buttons
-       void enableEditButtons();
+       /// Set availability of edit buttons
+       void setEditButtonStatus();
        /// Get default color of current theme at (row, column) in the colorsTV.
        /// If theme_colors_ is empty, this returns an invalid QColor.
        QColor getCurrentThemeColor(int const &row, bool const &is_dark_color);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to