]> git.lyx.org Git - features.git/commitdiff
Fix Disable Editing "Lock" icon protrudes into tab title on macOS
authorDaniel Ramoeller <d.lyx@web.de>
Mon, 22 Feb 2021 10:04:10 +0000 (11:04 +0100)
committerStephan Witt <switt@lyx.org>
Tue, 2 Mar 2021 17:38:14 +0000 (18:38 +0100)
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.

src/frontends/qt/GuiWorkArea.cpp

index 39be80cb03cf99809147fb6e081be8194920f4f6..2ce276ddaa077a0ccc154790ae1b131d03f8b727 100644 (file)
@@ -2020,10 +2020,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);