commit 58acfdf08600f7f269074ebf90cb18e60ed3dd02
Author: Daniel Ramoeller <d....@web.de>
Date:   Mon Feb 22 11:04:10 2021 +0100

    Fix Disable Editing "Lock" icon protrudes into tab title on macOS
    
    On macOS the Disable Editing "Lock" icon protrudes into tab title
    
    Also, since the close button is on the left, the lock is better positioned 
on the right.
    
    The detour via QIcon is to avoid a pixelated pixmap (because in LyX pixmaps 
don't adjust by default to the device's pixel ratio correctly).
    
    Also
    
    Fix for bug #12160.
    
    (cherry picked from commit fde432493d62607f8d6a3bd87adc1b1dcded75aa)
---
 src/frontends/qt4/GuiWorkArea.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/frontends/qt4/GuiWorkArea.cpp 
b/src/frontends/qt4/GuiWorkArea.cpp
index 731802087e..afb680e231 100644
--- a/src/frontends/qt4/GuiWorkArea.cpp
+++ b/src/frontends/qt4/GuiWorkArea.cpp
@@ -2142,10 +2142,21 @@ void TabWorkArea::updateTabTexts()
                        tab_text += "*";
                QString tab_tooltip = it->abs();
                if (buf.hasReadonlyFlag()) {
+#ifdef Q_OS_MAC
+                       QLabel * readOnlyButton = new QLabel();
+                       QIcon icon = QIcon(getPixmap("images/", 
"emblem-readonly", "svgz,png"));
+                       readOnlyButton->setPixmap(icon.pixmap(QSize(16, 16)));
+                       tabBar()->setTabButton(tab_index, QTabBar::RightSide, 
readOnlyButton);
+#else
                        setTabIcon(tab_index, QIcon(getPixmap("images/", 
"emblem-readonly", "svgz,png")));
+#endif
                        tab_tooltip = qt_("%1 (read only)").arg(tab_tooltip);
                } else
+#ifdef Q_OS_MAC
+                       tabBar()->setTabButton(tab_index, QTabBar::RightSide, 
0);
+#else
                        setTabIcon(tab_index, QIcon());
+#endif
                if (buf.notifiesExternalModification()) {
                        QString const warn = qt_("%1 (modified externally)");
                        tab_tooltip = warn.arg(tab_tooltip);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to