mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Add ability to set user defined toggle view action (#562)
Co-authored-by: Harbinder Saggu <harbinder.saggu@safe.com>
This commit is contained in:
parent
55ef6ef863
commit
9ec97a8867
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user