commit d53b17dd353ce86991c3d6ea72233327ddb27332
Author: Scott Kostyshak <skost...@lyx.org>
Date:   Sun Apr 6 13:53:49 2025 +0200

    Compilation fix: horizontalAdvance is Qt >= 5.11
    
    Consistent with c6e5823a.
    
    Amends ac7f11b4.
---
 src/frontends/qt/GuiPrefs.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 56ec8f1502..ddd7fb85b6 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1713,11 +1713,19 @@ void PrefColors::initializeColorsTV()
 
        QFont font;
        QFontMetrics fm(font);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
        int col_width = 
max(fm.horizontalAdvance(header_labels_[LightColorColumn]),
                            swatch_width_);
        colorsTV->setColumnWidth(LightColorColumn, col_width);
        col_width = max(fm.horizontalAdvance(header_labels_[DarkColorColumn]),
                        swatch_width_);
+#else
+       int col_width = max(fm.width(header_labels_[LightColorColumn]),
+                           swatch_width_);
+       colorsTV->setColumnWidth(LightColorColumn, col_width);
+       col_width = max(fm.width(header_labels_[DarkColorColumn]),
+                       swatch_width_);
+#endif
        colorsTV->setColumnWidth(DarkColorColumn, col_width);
        colorsTV->setSelectionMode(QAbstractItemView::ExtendedSelection);
        colorsTV->setSelectionBehavior(QAbstractItemView::SelectRows);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to