Skip to content

Commit dc57920

Browse files
committed
GUI - give the away dock's body a size of its own, so Qt 6.4 doesn't warn about a negative minimum
1 parent b870c2a commit dc57920

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎app/gui/widgets/awaydock.h‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <QColor>
2020
#include <QMainWindow>
2121
#include <QRect>
22+
#include <QSize>
2223
#include <QString>
2324
#include <QWidget>
2425

@@ -37,12 +38,22 @@ class AwayDockBody : public QWidget
3738
public:
3839
// Fixed at a pixel across the divider; free along it, so the dock — and
3940
// the separator Qt reserves beside it — runs the whole of its area.
40-
explicit AwayDockBody(Qt::Orientation across, QWidget* parent = nullptr) : QWidget(parent)
41+
explicit AwayDockBody(Qt::Orientation across, QWidget* parent = nullptr)
42+
: QWidget(parent), m_across(across)
4143
{
4244
if (across == Qt::Vertical) setFixedWidth(1); // a column at the side
4345
else setFixedHeight(1); // a row at the foot
4446
setAutoFillBackground(true); // the divider's background, set by setAwayDockColour
4547
}
48+
49+
// A size of its own. A widget without a layout answers an invalid -1,
50+
// and Qt 6.4's dock layout took the dock's minimum from it: (1, -1),
51+
// which it then refused with a warning.
52+
QSize sizeHint() const override { return m_across == Qt::Vertical ? QSize(1, 0) : QSize(0, 1); }
53+
QSize minimumSizeHint() const override { return sizeHint(); }
54+
55+
private:
56+
Qt::Orientation m_across;
4657
};
4758

4859
inline QDockWidget* makeAwayDock(QMainWindow* window, const QString& name, Qt::DockWidgetArea area)

0 commit comments

Comments
 (0)