From 48c6517305fb9c3d9d8557c6a92baf95512063bd Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 13 Nov 2023 12:36:34 +0100 Subject: [PATCH] #10785 Work-around for legend item disappearing when highlighted Seen on Linux only. The legend item would be wider than anticipated by the layout (for unknown reasons), and would be place on the next line. Added extra with to the size hint to work around the problem. --- ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp index 500e97e76a..4cbd930265 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp @@ -91,7 +91,10 @@ QSize RiuQwtPlotLegend::sizeHint() const if ( legendLayout->itemCount() % numColumns ) numRows++; - int width = numColumns * legendLayout->maxItemWidth(); + // Extra width to workaround layout issue on linux + // https://github.com/OPM/ResInsight/issues/10785 + const int extraWidth = 20; + const int width = numColumns * legendLayout->maxItemWidth() + extraWidth; int maxHeight = 0; for ( unsigned int i = 0; i < legendLayout->itemCount(); ++i )