File tree Expand file tree Collapse file tree 5 files changed +42
-10
lines changed Expand file tree Collapse file tree 5 files changed +42
-10
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,9 @@ void CAutoHideTab::contextMenuEvent(QContextMenuEvent* ev)
394
394
d->createAutoHideToAction (tr (" Bottom" ), SideBarBottom, menu);
395
395
396
396
Action = Menu.addAction (tr (" Unpin (Dock)" ), this , SLOT (unpinDockWidget ()));
397
+ Menu.addSeparator ();
398
+ Action = Menu.addAction (tr (" Close" ), this , SLOT (requestCloseDockWidget ()));
399
+ Action->setEnabled (d->DockWidget ->features ().testFlag (CDockWidget::DockWidgetClosable));
397
400
398
401
Menu.exec (ev->globalPos ());
399
402
}
@@ -537,4 +540,11 @@ void CAutoHideTab::mouseMoveEvent(QMouseEvent* ev)
537
540
}
538
541
539
542
543
+ // ============================================================================
544
+ void CAutoHideTab::requestCloseDockWidget ()
545
+ {
546
+ d->DockWidget ->requestCloseDockWidget ();
547
+ }
548
+
549
+
540
550
}
Original file line number Diff line number Diff line change @@ -150,6 +150,11 @@ public Q_SLOTS:
150
150
* Unpin and dock the auto hide widget
151
151
*/
152
152
void unpinDockWidget ();
153
+
154
+ /* *
155
+ * Calls the requestCloseDockWidget() function for the assigned dock widget
156
+ */
157
+ void requestCloseDockWidget ();
153
158
}; // class AutoHideTab
154
159
}
155
160
// namespace ads
Original file line number Diff line number Diff line change @@ -626,15 +626,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
626
626
void CDockAreaWidget::onTabCloseRequested (int Index)
627
627
{
628
628
ADS_PRINT (" CDockAreaWidget::onTabCloseRequested " << Index);
629
- auto * DockWidget = dockWidget (Index);
630
- if (DockWidget->features ().testFlag (CDockWidget::DockWidgetDeleteOnClose) || DockWidget->features ().testFlag (CDockWidget::CustomCloseHandling))
631
- {
632
- DockWidget->closeDockWidgetInternal ();
633
- }
634
- else
635
- {
636
- DockWidget->toggleView (false );
637
- }
629
+ dockWidget (Index)->requestCloseDockWidget ();
638
630
}
639
631
640
632
Original file line number Diff line number Diff line change @@ -1059,6 +1059,22 @@ void CDockWidget::closeDockWidget()
1059
1059
}
1060
1060
1061
1061
1062
+
1063
+ // ============================================================================
1064
+ void CDockWidget::requestCloseDockWidget ()
1065
+ {
1066
+ if (features ().testFlag (CDockWidget::DockWidgetDeleteOnClose)
1067
+ || features ().testFlag (CDockWidget::CustomCloseHandling))
1068
+ {
1069
+ closeDockWidgetInternal (false );
1070
+ }
1071
+ else
1072
+ {
1073
+ toggleView (false );
1074
+ }
1075
+ }
1076
+
1077
+
1062
1078
// ============================================================================
1063
1079
bool CDockWidget::closeDockWidgetInternal (bool ForceClose)
1064
1080
{
Original file line number Diff line number Diff line change @@ -584,10 +584,19 @@ public Q_SLOTS:
584
584
void deleteDockWidget ();
585
585
586
586
/* *
587
- * Closes the dock widget
587
+ * Closes the dock widget.
588
+ * The function forces closing of the dock widget even for CustomCloseHandling.
588
589
*/
589
590
void closeDockWidget ();
590
591
592
+ /* *
593
+ * Request closing of the dock widget.
594
+ * For DockWidget with default close handling, the function does the same
595
+ * like clodeDockWidget() but if the flas CustomCloseHandling is set,
596
+ * the function only emits the closeRequested() signal.
597
+ */
598
+ void requestCloseDockWidget ();
599
+
591
600
/* *
592
601
* Shows the widget in full-screen mode.
593
602
* Normally this function only affects windows. To make the interface
You can’t perform that action at this time.
0 commit comments