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);
|
d->createAutoHideToAction(tr("Bottom"), SideBarBottom, menu);
|
||||||
|
|
||||||
Action = Menu.addAction(tr("Unpin (Dock)"), this, SLOT(unpinDockWidget()));
|
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());
|
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
|
* Unpin and dock the auto hide widget
|
||||||
*/
|
*/
|
||||||
void unpinDockWidget();
|
void unpinDockWidget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the requestCloseDockWidget() function for the assigned dock widget
|
||||||
|
*/
|
||||||
|
void requestCloseDockWidget();
|
||||||
}; // class AutoHideTab
|
}; // class AutoHideTab
|
||||||
}
|
}
|
||||||
// namespace ads
|
// namespace ads
|
||||||
|
@ -626,15 +626,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
|||||||
void CDockAreaWidget::onTabCloseRequested(int Index)
|
void CDockAreaWidget::onTabCloseRequested(int Index)
|
||||||
{
|
{
|
||||||
ADS_PRINT("CDockAreaWidget::onTabCloseRequested " << Index);
|
ADS_PRINT("CDockAreaWidget::onTabCloseRequested " << Index);
|
||||||
auto* DockWidget = dockWidget(Index);
|
dockWidget(Index)->requestCloseDockWidget();
|
||||||
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose) || DockWidget->features().testFlag(CDockWidget::CustomCloseHandling))
|
|
||||||
{
|
|
||||||
DockWidget->closeDockWidgetInternal();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DockWidget->toggleView(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
bool CDockWidget::closeDockWidgetInternal(bool ForceClose)
|
||||||
{
|
{
|
||||||
|
@ -584,10 +584,19 @@ public Q_SLOTS:
|
|||||||
void deleteDockWidget();
|
void deleteDockWidget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the dock widget
|
* Closes the dock widget.
|
||||||
|
* The function forces closing of the dock widget even for CustomCloseHandling.
|
||||||
*/
|
*/
|
||||||
void closeDockWidget();
|
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.
|
* Shows the widget in full-screen mode.
|
||||||
* Normally this function only affects windows. To make the interface
|
* Normally this function only affects windows. To make the interface
|
||||||
|
Loading…
Reference in New Issue
Block a user