mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Added minimize and close action to Auto Hide context menu
This commit is contained in:
parent
9ec97a8867
commit
0f8096e314
@ -527,6 +527,7 @@ void MainWindowPrivate::createContent()
|
||||
|
||||
// Tests CustomCloseHandling without DeleteOnClose
|
||||
LabelDockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
|
||||
LabelDockWidget->setWindowTitle(LabelDockWidget->windowTitle() + " [Custom Close]");
|
||||
QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, [LabelDockWidget, this]()
|
||||
{
|
||||
int Result = QMessageBox::question(_this, "Custom Close Request",
|
||||
|
@ -431,6 +431,24 @@ void CDockAreaTitleBar::onCloseButtonClicked()
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaTitleBar::onAutoHideCloseActionTriggered()
|
||||
{
|
||||
d->DockArea->closeArea();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaTitleBar::onAutoHideMinimizeActionTriggered()
|
||||
{
|
||||
auto AutoHideContainer = d->DockArea->autoHideDockContainer();
|
||||
if (AutoHideContainer)
|
||||
{
|
||||
AutoHideContainer->collapseView(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaTitleBar::onUndockButtonClicked()
|
||||
{
|
||||
@ -735,7 +753,17 @@ void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
|
||||
}
|
||||
Menu.addSeparator();
|
||||
}
|
||||
|
||||
if (isAutoHide)
|
||||
{
|
||||
Action = Menu.addAction(tr("Minimize"), this, SLOT(onAutoHideMinimizeActionTriggered()));
|
||||
Action = Menu.addAction(tr("Close"), this, SLOT(onAutoHideCloseActionTriggered()));
|
||||
}
|
||||
else
|
||||
{
|
||||
Action = Menu.addAction(isAutoHide ? tr("Close") : tr("Close Group"), this, SLOT(onCloseButtonClicked()));
|
||||
}
|
||||
|
||||
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetClosable));
|
||||
if (!isAutoHide && !isTopLevelArea)
|
||||
{
|
||||
@ -782,7 +810,8 @@ QString CDockAreaTitleBar::titleBarButtonToolTip(TitleBarButton Button) const
|
||||
case TitleBarButtonClose:
|
||||
if (d->DockArea->isAutoHide())
|
||||
{
|
||||
return tr("Close");
|
||||
bool Minimize = CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideCloseButtonCollapsesDock);
|
||||
return Minimize ? tr("Minimize") : tr("Close");
|
||||
}
|
||||
|
||||
if (CDockManager::testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
|
||||
|
@ -97,6 +97,8 @@ private:
|
||||
private Q_SLOTS:
|
||||
void onTabsMenuAboutToShow();
|
||||
void onCloseButtonClicked();
|
||||
void onAutoHideCloseActionTriggered();
|
||||
void onAutoHideMinimizeActionTriggered();
|
||||
void onUndockButtonClicked();
|
||||
void onTabsMenuActionTriggered(QAction* Action);
|
||||
void onCurrentTabChanged(int Index);
|
||||
|
Loading…
Reference in New Issue
Block a user