Krita

DockWidget.cpp
1 /*
2  * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 #include "DockWidget.h"
7 #include <QDebug>
8 
9 #include <KoCanvasBase.h>
10 
11 #include "Canvas.h"
12 
13 struct DockWidget::Private {
14  Private() {}
15 
16  Canvas *canvas {0};
17 };
18 
19 DockWidget::DockWidget()
20  : QDockWidget()
21  , d(new Private)
22 {
23 }
24 
25 DockWidget::~DockWidget()
26 {
27  delete d;
28 }
29 
31 {
32  return d->canvas;
33 }
34 
35 void DockWidget::setCanvas(KoCanvasBase* canvas)
36 {
37  delete d->canvas;
38  d->canvas = new Canvas(canvas);
39  canvasChanged(d->canvas);
40 }
41 
42 void DockWidget::unsetCanvas()
43 {
44  canvasChanged(0);
45  delete d->canvas;
46  d->canvas = 0;
47 }
virtual void canvasChanged(Canvas *canvas)=0
canvasChanged is called whenever the current canvas is changed in the mainwindow this dockwidget inst...
Canvas wraps the canvas inside a view on an image/document.
Definition: Canvas.h:22
Canvas * canvas() const
@return the canvas object that this docker is currently associated with
Definition: DockWidget.cpp:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Dec 4 2022 04:12:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.