mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-22 12:56:11 +00:00
38 lines
749 B
C++
38 lines
749 B
C++
|
#include "CutterDockWidget.h"
|
||
|
#include "MainWindow.h"
|
||
|
|
||
|
|
||
|
CutterDockWidget::CutterDockWidget(MainWindow *main, QAction *action) :
|
||
|
QDockWidget(main),
|
||
|
action(action)
|
||
|
{
|
||
|
main->addToDockWidgetList(this);
|
||
|
if (action) {
|
||
|
main->addDockWidgetAction(this, action);
|
||
|
connect(action, &QAction::triggered, this, &CutterDockWidget::toggleDockWidget);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void CutterDockWidget::toggleDockWidget(bool show)
|
||
|
{
|
||
|
if (!show)
|
||
|
{
|
||
|
this->close();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this->show();
|
||
|
this->raise();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void CutterDockWidget::closeEvent(QCloseEvent * event) {
|
||
|
if (action) {
|
||
|
this->action->setChecked(false);
|
||
|
}
|
||
|
QDockWidget::closeEvent(event);
|
||
|
}
|
||
|
|
||
|
CutterDockWidget::~CutterDockWidget() {}
|