mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Added "Close" action to AutoHideTab context menu
This commit is contained in:
parent
df1bc94d9e
commit
0627b3183f
@ -394,6 +394,9 @@ void CAutoHideTab::contextMenuEvent(QContextMenuEvent* ev)
|
||||
d->createAutoHideToAction(tr("Bottom"), SideBarBottom, menu);
|
||||
|
||||
Action = Menu.addAction(tr("Unpin (Dock)"), this, SLOT(unpinDockWidget()));
|
||||
Menu.addSeparator();
|
||||
Action = Menu.addAction(tr("Close"), this, SLOT(requestCloseDockWidget()));
|
||||
Action->setEnabled(d->DockWidget->features().testFlag(CDockWidget::DockWidgetClosable));
|
||||
|
||||
Menu.exec(ev->globalPos());
|
||||
}
|
||||
@ -537,4 +540,11 @@ void CAutoHideTab::mouseMoveEvent(QMouseEvent* ev)
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CAutoHideTab::requestCloseDockWidget()
|
||||
{
|
||||
d->DockWidget->requestCloseDockWidget();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -150,6 +150,11 @@ public Q_SLOTS:
|
||||
* Unpin and dock the auto hide widget
|
||||
*/
|
||||
void unpinDockWidget();
|
||||
|
||||
/**
|
||||
* Calls the requestCloseDockWidget() function for the assigned dock widget
|
||||
*/
|
||||
void requestCloseDockWidget();
|
||||
}; // class AutoHideTab
|
||||
}
|
||||
// namespace ads
|
||||
|
@ -626,15 +626,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
||||
void CDockAreaWidget::onTabCloseRequested(int Index)
|
||||
{
|
||||
ADS_PRINT("CDockAreaWidget::onTabCloseRequested " << Index);
|
||||
auto* DockWidget = dockWidget(Index);
|
||||
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose) || DockWidget->features().testFlag(CDockWidget::CustomCloseHandling))
|
||||
{
|
||||
DockWidget->closeDockWidgetInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
DockWidget->toggleView(false);
|
||||
}
|
||||
dockWidget(Index)->requestCloseDockWidget();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1059,6 +1059,22 @@ void CDockWidget::closeDockWidget()
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockWidget::requestCloseDockWidget()
|
||||
{
|
||||
if (features().testFlag(CDockWidget::DockWidgetDeleteOnClose)
|
||||
|| features().testFlag(CDockWidget::CustomCloseHandling))
|
||||
{
|
||||
closeDockWidgetInternal(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
toggleView(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CDockWidget::closeDockWidgetInternal(bool ForceClose)
|
||||
{
|
||||
|
@ -584,10 +584,19 @@ public Q_SLOTS:
|
||||
void deleteDockWidget();
|
||||
|
||||
/**
|
||||
* Closes the dock widget
|
||||
* Closes the dock widget.
|
||||
* The function forces closing of the dock widget even for CustomCloseHandling.
|
||||
*/
|
||||
void closeDockWidget();
|
||||
|
||||
/**
|
||||
* Request closing of the dock widget.
|
||||
* For DockWidget with default close handling, the function does the same
|
||||
* like clodeDockWidget() but if the flas CustomCloseHandling is set,
|
||||
* the function only emits the closeRequested() signal.
|
||||
*/
|
||||
void requestCloseDockWidget();
|
||||
|
||||
/**
|
||||
* Shows the widget in full-screen mode.
|
||||
* Normally this function only affects windows. To make the interface
|
||||
|
Loading…
Reference in New Issue
Block a user