@@ -185,6 +185,30 @@ class CTitleBarButton : public tTitleBarButton
185185};
186186
187187
188+ /* *
189+ * This spacer widget is here because of the following problem.
190+ * The dock area title bar handles mouse dragging and moving the floating widget.
191+ * The problem is, that if the title bar becomes invisible, i.e. if the dock
192+ * area contains only one single dock widget and the dock area is moved
193+ * into a floating widget, then mouse events are not handled anymore and dragging
194+ * of the floating widget stops.
195+ */
196+ class CSpacerWidget : public QWidget
197+ {
198+ Q_OBJECT
199+ public:
200+ using Super = QWidget;
201+ CSpacerWidget (QWidget* Parent = 0 )
202+ : Super(Parent)
203+ {
204+ setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
205+ setStyleSheet (" border: none; background: none;" );
206+ }
207+ virtual QSize sizeHint () const override {return QSize (0 , 0 );}
208+ virtual QSize minimumSizeHint () const override {return QSize (0 , 0 );}
209+ };
210+
211+
188212// ============================================================================
189213DockAreaTitleBarPrivate::DockAreaTitleBarPrivate (CDockAreaTitleBar* _public) :
190214 _this(_public)
@@ -322,8 +346,7 @@ CDockAreaTitleBar::CDockAreaTitleBar(CDockAreaWidget* parent) :
322346 setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Fixed);
323347
324348 d->createTabBar ();
325- auto horizontalSpacer = new QSpacerItem (0 , 0 , QSizePolicy::Expanding, QSizePolicy::Minimum);
326- d->Layout ->addSpacerItem (horizontalSpacer);
349+ d->Layout ->addWidget (new CSpacerWidget (this ));
327350 d->createButtons ();
328351}
329352
0 commit comments