Commit cf145b39 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix detaching canvas

parent 56fc906a
...@@ -39,7 +39,7 @@ KisCanvasWindow::KisCanvasWindow(KisMainWindow *mainWindow) ...@@ -39,7 +39,7 @@ KisCanvasWindow::KisCanvasWindow(KisMainWindow *mainWindow)
setLayout(layout); setLayout(layout);
} }
KisCanvasWindow::~KisCanvasWindow() {} KisCanvasWindow::~KisCanvasWindow() = default;
void KisCanvasWindow::closeEvent(QCloseEvent *event) void KisCanvasWindow::closeEvent(QCloseEvent *event)
{ {
......
...@@ -110,7 +110,6 @@ ...@@ -110,7 +110,6 @@
#include "dialogs/kis_about_application.h" #include "dialogs/kis_about_application.h"
#include "dialogs/kis_delayed_save_dialog.h" #include "dialogs/kis_delayed_save_dialog.h"
#include "dialogs/kis_dlg_preferences.h" #include "dialogs/kis_dlg_preferences.h"
#include "kis_action.h"
#include "kis_action_manager.h" #include "kis_action_manager.h"
#include "KisApplication.h" #include "KisApplication.h"
#include "kis_canvas2.h" #include "kis_canvas2.h"
...@@ -148,6 +147,7 @@ ...@@ -148,6 +147,7 @@
#include <KritaVersionWrapper.h> #include <KritaVersionWrapper.h>
#include <kritaversion.h> #include <kritaversion.h>
#include "KisCanvasWindow.h" #include "KisCanvasWindow.h"
#include "kis_action.h"
#include <mutex> #include <mutex>
...@@ -733,7 +733,7 @@ void KisMainWindow::slotThemeChanged() ...@@ -733,7 +733,7 @@ void KisMainWindow::slotThemeChanged()
bool KisMainWindow::canvasDetached() const bool KisMainWindow::canvasDetached() const
{ {
return centralWidget() != d->mdiArea; return centralWidget() != d->widgetStack;
} }
void KisMainWindow::setCanvasDetached(bool detach) void KisMainWindow::setCanvasDetached(bool detach)
...@@ -748,14 +748,10 @@ void KisMainWindow::setCanvasDetached(bool detach) ...@@ -748,14 +748,10 @@ void KisMainWindow::setCanvasDetached(bool detach)
} }
if (detach) { if (detach) {
KIS_SAFE_ASSERT_RECOVER_NOOP(outgoingWidget == d->mdiArea);
d->canvasWindow->show(); d->canvasWindow->show();
} else { } else {
KIS_SAFE_ASSERT_RECOVER_NOOP(incomingWidget == d->mdiArea);
d->canvasWindow->hide(); d->canvasWindow->hide();
} }
d->toggleDetachCanvas->setChecked(detach);
} }
QWidget * KisMainWindow::canvasWindow() const QWidget * KisMainWindow::canvasWindow() const
...@@ -2602,6 +2598,7 @@ void KisMainWindow::createActions() ...@@ -2602,6 +2598,7 @@ void KisMainWindow::createActions()
d->toggleDetachCanvas = actionManager->createAction("view_detached_canvas"); d->toggleDetachCanvas = actionManager->createAction("view_detached_canvas");
d->toggleDetachCanvas->setChecked(false); d->toggleDetachCanvas->setChecked(false);
connect(d->toggleDetachCanvas, SIGNAL(toggled(bool)), SLOT(setCanvasDetached(bool))); connect(d->toggleDetachCanvas, SIGNAL(toggled(bool)), SLOT(setCanvasDetached(bool)));
setCanvasDetached(false);
actionCollection()->addAction("settings_dockers_menu", d->dockWidgetMenu); actionCollection()->addAction("settings_dockers_menu", d->dockWidgetMenu);
actionCollection()->addAction("window", d->windowMenu); actionCollection()->addAction("window", d->windowMenu);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment