@@ -35,6 +35,7 @@ struct FloatingDragPreviewPrivate
35
35
{
36
36
CFloatingDragPreview *_this;
37
37
QWidget* Content;
38
+ CDockWidget::DockWidgetFeatures ContentFeatures;
38
39
CDockAreaWidget* ContentSourceArea = nullptr ;
39
40
QPoint DragStartMousePosition;
40
41
CDockManager* DockManager;
@@ -79,20 +80,36 @@ struct FloatingDragPreviewPrivate
79
80
* Returns true, if the content is floatable
80
81
*/
81
82
bool isContentFloatable () const
83
+ {
84
+ return this ->ContentFeatures .testFlag (CDockWidget::DockWidgetFloatable);
85
+ }
86
+
87
+ /* *
88
+ * Returns true, if the content is pinnable
89
+ */
90
+ bool isContentPinnable () const
91
+ {
92
+ return this ->ContentFeatures .testFlag (CDockWidget::DockWidgetPinnable);
93
+ }
94
+
95
+ /* *
96
+ * Returns the content features
97
+ */
98
+ CDockWidget::DockWidgetFeatures contentFeatures () const
82
99
{
83
100
CDockWidget* DockWidget = qobject_cast<CDockWidget*>(Content);
84
- if (DockWidget && DockWidget-> features (). testFlag (CDockWidget::DockWidgetFloatable) )
101
+ if (DockWidget)
85
102
{
86
- return true ;
103
+ return DockWidget-> features () ;
87
104
}
88
105
89
106
CDockAreaWidget* DockArea = qobject_cast<CDockAreaWidget*>(Content);
90
- if (DockArea && DockArea-> features (). testFlag (CDockWidget::DockWidgetFloatable) )
107
+ if (DockArea)
91
108
{
92
- return true ;
109
+ return DockArea-> features () ;
93
110
}
94
111
95
- return false ;
112
+ return CDockWidget::DockWidgetFeatures () ;
96
113
}
97
114
};
98
115
// struct LedArrayPanelPrivate
@@ -152,17 +169,22 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
152
169
VisibleDockAreas++;
153
170
}
154
171
155
- DockWidgetAreas AllowedAreas = (VisibleDockAreas > 1 ) ? OuterDockAreas : AllDockAreas;
172
+ DockWidgetAreas AllowedContainerAreas = (VisibleDockAreas > 1 ) ? OuterDockAreas : AllDockAreas;
156
173
// ContainerOverlay->enableDropPreview(ContainerDropArea != InvalidDockWidgetArea);
157
174
auto DockArea = TopContainer->dockAreaAt (GlobalPos);
158
175
// If the dock container contains only one single DockArea, then we need
159
176
// to respect the allowed areas - only the center area is relevant here because
160
177
// all other allowed areas are from the container
161
178
if (VisibleDockAreas == 1 && DockArea)
162
179
{
163
- AllowedAreas .setFlag (CenterDockWidgetArea, DockArea->allowedAreas ().testFlag (CenterDockWidgetArea));
180
+ AllowedContainerAreas .setFlag (CenterDockWidgetArea, DockArea->allowedAreas ().testFlag (CenterDockWidgetArea));
164
181
}
165
- ContainerOverlay->setAllowedAreas (AllowedAreas);
182
+
183
+ if (isContentPinnable ())
184
+ {
185
+ AllowedContainerAreas |= AutoHideDockAreas;
186
+ }
187
+ ContainerOverlay->setAllowedAreas (AllowedContainerAreas);
166
188
ContainerOverlay->enableDropPreview (ContainerDropArea != InvalidDockWidgetArea);
167
189
if (DockArea && DockArea->isVisible () && VisibleDockAreas >= 0 && DockArea != ContentSourceArea)
168
190
{
@@ -259,6 +281,7 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
259
281
d (new FloatingDragPreviewPrivate(this ))
260
282
{
261
283
d->Content = Content;
284
+ d->ContentFeatures = d->contentFeatures ();
262
285
setAttribute (Qt::WA_DeleteOnClose);
263
286
if (CDockManager::testConfigFlag (CDockManager::DragPreviewHasWindowFrame))
264
287
{
@@ -278,8 +301,6 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
278
301
setWindowFlags (Flags);
279
302
#endif
280
303
281
- setWindowOpacity (0.6 );
282
-
283
304
// Create a static image of the widget that should get undocked
284
305
// This is like some kind preview image like it is uses in drag and drop
285
306
// operations
@@ -437,6 +458,7 @@ void CFloatingDragPreview::paintEvent(QPaintEvent* event)
437
458
}
438
459
439
460
QPainter painter (this );
461
+ painter.setOpacity (0.6 );
440
462
if (CDockManager::testConfigFlag (CDockManager::DragPreviewShowsContentPixmap))
441
463
{
442
464
painter.drawPixmap (QPoint (0 , 0 ), d->ContentPreviewPixmap );
0 commit comments