Hi,

Since the update of Qt to 5.9.6 I was experiencing a bug. Specifically,
certain GUI widgets of the mail/trojita port did not take all the space
available, which resulted in quite some screen estate being wasted.
I am not aware of any other ports that are affected.

Today I noticed that a commit appeared on the 5.9 branch of qtbase which
fixes the problem. Apparently the bug was known for some time already.
The diff below backports the commit.

The bug report: https://bugreports.qt.io/browse/QTBUG-68939
The commit:
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=eaa2e164b0559b37dbcd060cd31e110d2775ffd6

Would you mind reviewing and committing the patch?

Thanks,
Caspar Schutijser


Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/qt5/qtbase/Makefile,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile
--- Makefile    11 Mar 2018 08:20:22 -0000      1.19
+++ Makefile    16 Aug 2018 18:06:29 -0000
@@ -17,6 +17,8 @@ PKGNAME-psql =                qt5-postgresql-${VERSION
 PKGNAME-sqlite2 =      qt5-sqlite2-${VERSION}
 PKGNAME-tds =          qt5-tds-${VERSION}
 
+REVISION-main =                0
+
 PKG_ARCH-global =      *
 PKG_ARCH-examples =    *
 
Index: patches/patch-src_widgets_widgets_qdockarealayout_cpp
===================================================================
RCS file: patches/patch-src_widgets_widgets_qdockarealayout_cpp
diff -N patches/patch-src_widgets_widgets_qdockarealayout_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_widgets_widgets_qdockarealayout_cpp       16 Aug 2018 
18:06:29 -0000
@@ -0,0 +1,92 @@
+$OpenBSD$
+
+Backport
+https://code.qt.io/cgit/qt/qtbase.git/commit/?id=eaa2e164b0559b37dbcd060cd31e110d2775ffd6
+which fixes https://bugreports.qt.io/browse/QTBUG-68939
+
+Index: src/widgets/widgets/qdockarealayout.cpp
+--- src/widgets/widgets/qdockarealayout.cpp.orig
++++ src/widgets/widgets/qdockarealayout.cpp
+@@ -226,7 +226,7 @@ static quintptr tabId(const QDockAreaLayoutItem &item)
+ static const int zero = 0;
+ 
+ QDockAreaLayoutInfo::QDockAreaLayoutInfo()
+-    : restoredSizeHint(0,0), sep(&zero), dockPos(QInternal::LeftDock), 
o(Qt::Horizontal), mainWindow(0)
++    : sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), 
mainWindow(0)
+ #if QT_CONFIG(tabbar)
+     , tabbed(false), tabBar(0), tabBarShape(QTabBar::RoundedSouth)
+ #endif
+@@ -236,7 +236,7 @@ QDockAreaLayoutInfo::QDockAreaLayoutInfo()
+ QDockAreaLayoutInfo::QDockAreaLayoutInfo(const int *_sep, 
QInternal::DockPosition _dockPos,
+                                             Qt::Orientation _o, int tbshape,
+                                             QMainWindow *window)
+-    : restoredSizeHint(0,0), sep(_sep), dockPos(_dockPos), o(_o), 
mainWindow(window)
++    : sep(_sep), dockPos(_dockPos), o(_o), mainWindow(window)
+ #if QT_CONFIG(tabbar)
+     , tabbed(false), tabBar(0), 
tabBarShape(static_cast<QTabBar::Shape>(tbshape))
+ #endif
+@@ -407,9 +407,6 @@ QSize QDockAreaLayoutInfo::sizeHint() const
+     if (isEmpty())
+         return QSize(0, 0);
+ 
+-    if (!restoredSizeHint.isNull())
+-        return restoredSizeHint;
+-
+     int a = 0, b = 0;
+     int min_perp = 0;
+     int max_perp = QWIDGETSIZE_MAX;
+@@ -2376,7 +2373,6 @@ bool QDockAreaLayout::restoreState(QDataStream &stream
+         stream >> size;
+         if (!testing) {
+             docks[pos].rect = QRect(QPoint(0, 0), size);
+-            docks[pos].restoredSizeHint = size;
+         }
+         if (!docks[pos].restoreState(stream, dockwidgets, testing)) {
+             stream.setStatus(QDataStream::ReadCorruptData);
+@@ -2678,8 +2674,6 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *
+         center_rect.setBottom(rect.bottom() - 
docks[QInternal::BottomDock].rect.height() - sep);
+ 
+     QSize left_hint = docks[QInternal::LeftDock].size();
+-    if (!docks[QInternal::LeftDock].restoredSizeHint.isNull())
+-        left_hint = docks[QInternal::LeftDock].restoredSizeHint;
+     if (left_hint.isNull() || fallbackToSizeHints)
+         left_hint = docks[QInternal::LeftDock].sizeHint();
+     QSize left_min = docks[QInternal::LeftDock].minimumSize();
+@@ -2687,8 +2681,6 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *
+     left_hint = left_hint.boundedTo(left_max).expandedTo(left_min);
+ 
+     QSize right_hint = docks[QInternal::RightDock].size();
+-    if (!docks[QInternal::RightDock].restoredSizeHint.isNull())
+-        right_hint = docks[QInternal::RightDock].restoredSizeHint;
+     if (right_hint.isNull() || fallbackToSizeHints)
+         right_hint = docks[QInternal::RightDock].sizeHint();
+     QSize right_min = docks[QInternal::RightDock].minimumSize();
+@@ -2696,8 +2688,6 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *
+     right_hint = right_hint.boundedTo(right_max).expandedTo(right_min);
+ 
+     QSize top_hint = docks[QInternal::TopDock].size();
+-    if (!docks[QInternal::TopDock].restoredSizeHint.isNull())
+-        top_hint = docks[QInternal::TopDock].restoredSizeHint;
+     if (top_hint.isNull() || fallbackToSizeHints)
+         top_hint = docks[QInternal::TopDock].sizeHint();
+     QSize top_min = docks[QInternal::TopDock].minimumSize();
+@@ -2705,8 +2695,6 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *
+     top_hint = top_hint.boundedTo(top_max).expandedTo(top_min);
+ 
+     QSize bottom_hint = docks[QInternal::BottomDock].size();
+-    if (!docks[QInternal::BottomDock].restoredSizeHint.isNull())
+-        bottom_hint = docks[QInternal::BottomDock].restoredSizeHint;
+     if (bottom_hint.isNull() || fallbackToSizeHints)
+         bottom_hint = docks[QInternal::BottomDock].sizeHint();
+     QSize bottom_min = docks[QInternal::BottomDock].minimumSize();
+@@ -3287,10 +3275,6 @@ int QDockAreaLayout::separatorMove(const QList<int> &s
+ {
+     int delta = 0;
+     int index = separator.last();
+-
+-    for (int i = 0; i < QInternal::DockCount; ++i)
+-        if (!docks[i].restoredSizeHint.isNull())
+-            docks[i].restoredSizeHint = QSize(0, 0);
+ 
+     if (separator.count() > 1) {
+         QDockAreaLayoutInfo *info = this->info(separator);
Index: patches/patch-src_widgets_widgets_qdockarealayout_p_h
===================================================================
RCS file: patches/patch-src_widgets_widgets_qdockarealayout_p_h
diff -N patches/patch-src_widgets_widgets_qdockarealayout_p_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_widgets_widgets_qdockarealayout_p_h       16 Aug 2018 
18:06:29 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Backport
+https://code.qt.io/cgit/qt/qtbase.git/commit/?id=eaa2e164b0559b37dbcd060cd31e110d2775ffd6
+which fixes https://bugreports.qt.io/browse/QTBUG-68939
+
+Index: src/widgets/widgets/qdockarealayout_p.h
+--- src/widgets/widgets/qdockarealayout_p.h.orig
++++ src/widgets/widgets/qdockarealayout_p.h
+@@ -189,7 +189,6 @@ class Q_AUTOTEST_EXPORT QDockAreaLayoutInfo (public)
+ 
+     QMainWindowLayout *mainWindowLayout() const;
+ 
+-    QSize restoredSizeHint;
+     const int *sep;
+     mutable QVector<QWidget*> separatorWidgets;
+     QInternal::DockPosition dockPos;

Reply via email to