mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
Delete Extra Widgets on Close (#1490)
This commit is contained in:
parent
dff08963a1
commit
1cc6abee44
@ -315,24 +315,25 @@ void MainWindow::updateTasksIndicator()
|
||||
|
||||
void MainWindow::on_actionExtraGraph_triggered()
|
||||
{
|
||||
QDockWidget *extraDock = new GraphWidget(this, 0);
|
||||
auto *extraDock = new GraphWidget(this, nullptr);
|
||||
addExtraWidget(extraDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExtraHexdump_triggered()
|
||||
{
|
||||
QDockWidget *extraDock = new HexdumpWidget(this, 0);
|
||||
auto *extraDock = new HexdumpWidget(this, nullptr);
|
||||
addExtraWidget(extraDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExtraDisassembly_triggered()
|
||||
{
|
||||
QDockWidget *extraDock = new DisassemblyWidget(this, 0);
|
||||
auto *extraDock = new DisassemblyWidget(this, nullptr);
|
||||
addExtraWidget(extraDock);
|
||||
}
|
||||
|
||||
void MainWindow::addExtraWidget(QDockWidget *extraDock)
|
||||
void MainWindow::addExtraWidget(CutterDockWidget *extraDock)
|
||||
{
|
||||
extraDock->setTransient(true);
|
||||
addDockWidget(Qt::TopDockWidgetArea, extraDock);
|
||||
auto restoreExtraDock = qhelpers::forceWidth(extraDock->widget(), 600);
|
||||
qApp->processEvents();
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
|
||||
void addToDockWidgetList(QDockWidget *dockWidget);
|
||||
void addDockWidgetAction(QDockWidget *dockWidget, QAction *action);
|
||||
void addExtraWidget(QDockWidget *extraDock);
|
||||
void addExtraWidget(CutterDockWidget *extraDock);
|
||||
|
||||
void addPluginDockWidget(QDockWidget *dockWidget, QAction *action);
|
||||
enum class MenuType { File, Edit, View, Windows, Debug, Help, Plugins };
|
||||
|
@ -68,6 +68,9 @@ void CutterDockWidget::closeEvent(QCloseEvent *event)
|
||||
this->action->setChecked(false);
|
||||
}
|
||||
QDockWidget::closeEvent(event);
|
||||
if (isTransient) {
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
QAction *CutterDockWidget::getBoundAction() const
|
||||
|
@ -17,6 +17,12 @@ public:
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
bool isVisibleToUser() { return isVisibleToUserCurrent; }
|
||||
|
||||
/**
|
||||
* @brief Set whether the Widget should be deleted after it is closed.
|
||||
* This is especially important for extra widgets.
|
||||
*/
|
||||
void setTransient(bool v) { isTransient = v; }
|
||||
|
||||
/**
|
||||
* @brief Convenience method for creating and registering a RefreshDeferrer without any parameters
|
||||
* @param refreshNowFunc lambda taking no parameters, called when a refresh should occur
|
||||
@ -64,6 +70,8 @@ protected:
|
||||
private:
|
||||
QAction *action;
|
||||
|
||||
bool isTransient = false;
|
||||
|
||||
bool isVisibleToUserCurrent = false;
|
||||
void updateIsVisibleToUser();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user