Add ability to set user defined toggle view action (#562)

Co-authored-by: Harbinder Saggu <harbinder.saggu@safe.com>
This commit is contained in:
uggas 2023-10-18 23:07:55 -07:00 committed by GitHub
parent 55ef6ef863
commit 9ec97a8867
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -364,6 +364,20 @@ CDockWidget::~CDockWidget()
delete d;
}
//============================================================================
void CDockWidget::setToggleViewAction(QAction* action)
{
if (!action)
{
return;
}
d->ToggleViewAction->setParent(nullptr);
delete d->ToggleViewAction;
d->ToggleViewAction = action;
d->ToggleViewAction->setParent(this);
connect(d->ToggleViewAction, &QAction::triggered, this, &CDockWidget::toggleView);
}
//============================================================================
void CDockWidget::setToggleViewActionChecked(bool Checked)

View File

@ -409,6 +409,12 @@ public:
*/
QAction* toggleViewAction() const;
/**
* Use provided action to be the default toggle view action for this dock widget.
* This dock widget now owns the action.
*/
void setToggleViewAction(QAction* action);
/**
* Configures the behavior of the toggle view action.
* \see eToggleViewActionMode for a detailed description