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)
394394 d->createAutoHideToAction (tr (" Bottom" ), SideBarBottom, menu);
395395
396396 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));
397400
398401 Menu.exec (ev->globalPos ());
399402}
@@ -537,4 +540,11 @@ void CAutoHideTab::mouseMoveEvent(QMouseEvent* ev)
537540}
538541
539542
543+ // ============================================================================
544+ void CAutoHideTab::requestCloseDockWidget ()
545+ {
546+ d->DockWidget ->requestCloseDockWidget ();
547+ }
548+
549+
540550}
Original file line number Diff line number Diff line change @@ -150,6 +150,11 @@ public Q_SLOTS:
150150 * Unpin and dock the auto hide widget
151151 */
152152 void unpinDockWidget ();
153+
154+ /* *
155+ * Calls the requestCloseDockWidget() function for the assigned dock widget
156+ */
157+ void requestCloseDockWidget ();
153158}; // class AutoHideTab
154159}
155160 // namespace ads
Original file line number Diff line number Diff line change @@ -626,15 +626,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
626626void CDockAreaWidget::onTabCloseRequested (int Index)
627627{
628628 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 ();
638630}
639631
640632
Original file line number Diff line number Diff line change @@ -1059,6 +1059,22 @@ void CDockWidget::closeDockWidget()
10591059}
10601060
10611061
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+
10621078// ============================================================================
10631079bool CDockWidget::closeDockWidgetInternal (bool ForceClose)
10641080{
Original file line number Diff line number Diff line change @@ -584,10 +584,19 @@ public Q_SLOTS:
584584 void deleteDockWidget ();
585585
586586 /* *
587- * Closes the dock widget
587+ * Closes the dock widget.
588+ * The function forces closing of the dock widget even for CustomCloseHandling.
588589 */
589590 void closeDockWidget ();
590591
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+
591600 /* *
592601 * Shows the widget in full-screen mode.
593602 * Normally this function only affects windows. To make the interface
You can’t perform that action at this time.
0 commit comments