On 2020-08-06 11:22, Jean-Marc Lasgouttes wrote:
Le 6 août 2020 09:46:36 GMT+02:00, Daniel <xraco...@gmx.de> a écrit :
I noticed that the corners of rectangles in LyX are drawn bevel instead

of a pointy since they are drawn with the Qt default, see

https://doc.qt.io/qt-5/qpen.html#QPen-3
https://doc.qt.io/qt-5/qt.html#PenJoinStyle-enum

I don't think the bevel corners are intentional in LyX and the attached

patch is intended to fix this. One effect is that the corners of insets

are pointy, see before and after pictures attached.

You might have wondered what the strange gap in the label is. This is
fixed at https://www.lyx.org/trac/ticket/10323.

Looks like a good idea. I think though that you could just enforce it and not 
expose the parameters to our painter.

Attached. Is the idea to better not introduce any parameters (complexity) before they become really useful?

--
Daniel
From 669808dc747613244487a0da36e5ca7a99ef16f9 Mon Sep 17 00:00:00 2001
From: Daniel Ramoeller <d....@web.de>
Date: Thu, 6 Aug 2020 12:07:22 +0200
Subject: [PATCH] Fix for non-pointy rectangles

The default to join lines in Qt is bevel (Qt::BevelJoin) but for rectangles it 
should be pointy (Qt::MiterJoin).
---
 src/frontends/qt/GuiPainter.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/frontends/qt/GuiPainter.cpp b/src/frontends/qt/GuiPainter.cpp
index d9074cb427..5592effab3 100644
--- a/src/frontends/qt/GuiPainter.cpp
+++ b/src/frontends/qt/GuiPainter.cpp
@@ -211,6 +211,11 @@ void GuiPainter::rectangle(int x, int y, int w, int h,
        int lw)
 {
        setQPainterPen(computeColor(col), ls, lw);
+       // make rectangles have pointed corners (miter) rather than the default 
bevel
+       QPen p = pen();
+       p.setJoinStyle(Qt::MiterJoin);
+       setPen(p);
+       
        drawRect(x, y, w, h);
 }
 
-- 
2.24.3 (Apple Git-128)

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to