@@ -35,6 +35,7 @@ struct FloatingDragPreviewPrivate
3535{
3636 CFloatingDragPreview *_this;
3737 QWidget* Content;
38+ CDockWidget::DockWidgetFeatures ContentFeatures;
3839 CDockAreaWidget* ContentSourceArea = nullptr ;
3940 QPoint DragStartMousePosition;
4041 CDockManager* DockManager;
@@ -79,20 +80,36 @@ struct FloatingDragPreviewPrivate
7980 * Returns true, if the content is floatable
8081 */
8182 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
8299 {
83100 CDockWidget* DockWidget = qobject_cast<CDockWidget*>(Content);
84- if (DockWidget && DockWidget-> features (). testFlag (CDockWidget::DockWidgetFloatable) )
101+ if (DockWidget)
85102 {
86- return true ;
103+ return DockWidget-> features () ;
87104 }
88105
89106 CDockAreaWidget* DockArea = qobject_cast<CDockAreaWidget*>(Content);
90- if (DockArea && DockArea-> features (). testFlag (CDockWidget::DockWidgetFloatable) )
107+ if (DockArea)
91108 {
92- return true ;
109+ return DockArea-> features () ;
93110 }
94111
95- return false ;
112+ return CDockWidget::DockWidgetFeatures () ;
96113 }
97114};
98115// struct LedArrayPanelPrivate
@@ -152,17 +169,22 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
152169 VisibleDockAreas++;
153170 }
154171
155- DockWidgetAreas AllowedAreas = (VisibleDockAreas > 1 ) ? OuterDockAreas : AllDockAreas;
172+ DockWidgetAreas AllowedContainerAreas = (VisibleDockAreas > 1 ) ? OuterDockAreas : AllDockAreas;
156173 // ContainerOverlay->enableDropPreview(ContainerDropArea != InvalidDockWidgetArea);
157174 auto DockArea = TopContainer->dockAreaAt (GlobalPos);
158175 // If the dock container contains only one single DockArea, then we need
159176 // to respect the allowed areas - only the center area is relevant here because
160177 // all other allowed areas are from the container
161178 if (VisibleDockAreas == 1 && DockArea)
162179 {
163- AllowedAreas .setFlag (CenterDockWidgetArea, DockArea->allowedAreas ().testFlag (CenterDockWidgetArea));
180+ AllowedContainerAreas .setFlag (CenterDockWidgetArea, DockArea->allowedAreas ().testFlag (CenterDockWidgetArea));
164181 }
165- ContainerOverlay->setAllowedAreas (AllowedAreas);
182+
183+ if (isContentPinnable ())
184+ {
185+ AllowedContainerAreas |= AutoHideDockAreas;
186+ }
187+ ContainerOverlay->setAllowedAreas (AllowedContainerAreas);
166188 ContainerOverlay->enableDropPreview (ContainerDropArea != InvalidDockWidgetArea);
167189 if (DockArea && DockArea->isVisible () && VisibleDockAreas >= 0 && DockArea != ContentSourceArea)
168190 {
@@ -259,6 +281,7 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
259281 d (new FloatingDragPreviewPrivate(this ))
260282{
261283 d->Content = Content;
284+ d->ContentFeatures = d->contentFeatures ();
262285 setAttribute (Qt::WA_DeleteOnClose);
263286 if (CDockManager::testConfigFlag (CDockManager::DragPreviewHasWindowFrame))
264287 {
@@ -278,8 +301,6 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
278301 setWindowFlags (Flags);
279302#endif
280303
281- setWindowOpacity (0.6 );
282-
283304 // Create a static image of the widget that should get undocked
284305 // This is like some kind preview image like it is uses in drag and drop
285306 // operations
@@ -437,6 +458,7 @@ void CFloatingDragPreview::paintEvent(QPaintEvent* event)
437458 }
438459
439460 QPainter painter (this );
461+ painter.setOpacity (0.6 );
440462 if (CDockManager::testConfigFlag (CDockManager::DragPreviewShowsContentPixmap))
441463 {
442464 painter.drawPixmap (QPoint (0 , 0 ), d->ContentPreviewPixmap );
0 commit comments