@@ -185,6 +185,30 @@ class CTitleBarButton : public tTitleBarButton
185
185
};
186
186
187
187
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
+
188
212
// ============================================================================
189
213
DockAreaTitleBarPrivate::DockAreaTitleBarPrivate (CDockAreaTitleBar* _public) :
190
214
_this(_public)
@@ -322,8 +346,7 @@ CDockAreaTitleBar::CDockAreaTitleBar(CDockAreaWidget* parent) :
322
346
setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Fixed);
323
347
324
348
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 ));
327
350
d->createButtons ();
328
351
}
329
352
0 commit comments