Krita Source Code Documentation
Loading...
Searching...
No Matches
HistoryDock Class Reference

#include <HistoryDock.h>

+ Inheritance diagram for HistoryDock:

Public Member Functions

 HistoryDock ()
 
QString observerName () override
 
void setCanvas (KoCanvasBase *canvas) override
 
void unsetCanvas () override
 
- Public Member Functions inherited from KoCanvasObserverBase
 KoCanvasObserverBase ()
 
KoCanvasBaseobservedCanvas () const
 
void setObservedCanvas (KoCanvasBase *canvas)
 
void unsetObservedCanvas ()
 
virtual ~KoCanvasObserverBase ()
 

Private Attributes

KisUndoViewm_undoView
 

Additional Inherited Members

Detailed Description

Definition at line 25 of file HistoryDock.h.

Constructor & Destructor Documentation

◆ HistoryDock()

HistoryDock::HistoryDock ( )

Definition at line 17 of file HistoryDock.cpp.

18 : QDockWidget()
19 , m_undoView(new KisUndoView(this))
20{
21 setWidget(m_undoView);
22 setWindowTitle(i18n("Undo History"));
23}
KisUndoView * m_undoView
Definition HistoryDock.h:35
The KisUndoView class displays the contents of a KUndo2QStack.
Definition KisUndoView.h:66

References m_undoView.

Member Function Documentation

◆ observerName()

QString HistoryDock::observerName ( )
inlineoverridevirtual

Reimplemented from KoCanvasObserverBase.

Definition at line 30 of file HistoryDock.h.

30{ return "HistoryDock"; }

◆ setCanvas()

void HistoryDock::setCanvas ( KoCanvasBase * canvas)
overridevirtual

re-implement this method in your canvas observer. It will be called whenever a canvas becomes active. Note that you are responsible for not connecting more than one time to the signals of a canvas or any of the QObjects you can access through the canvas.

Implements KoCanvasObserverBase.

Definition at line 25 of file HistoryDock.cpp.

26{
27 setEnabled(canvas != 0);
28 QPointer<KisCanvas2> myCanvas = dynamic_cast<KisCanvas2*>(canvas);
29 if (myCanvas
30 && myCanvas->shapeController()
31 && myCanvas->shapeController()->resourceManager()
32 && myCanvas->shapeController()->resourceManager()->undoStack()) {
33 KUndo2Stack* undoStack = myCanvas->shapeController()->resourceManager()->undoStack();
34
35 m_undoView->setStack(undoStack);
36 }
37 m_undoView->setCanvas( myCanvas );
38
39}
void setCanvas(KisCanvas2 *canvas)
void setStack(KUndo2QStack *stack)

References m_undoView, KisUndoView::setCanvas(), and KisUndoView::setStack().

◆ unsetCanvas()

void HistoryDock::unsetCanvas ( )
overridevirtual

Re-implement to notify the observer that its canvas is no longer among the living. The daisies, it is pushing up. This means you don't have to disconnect, it's dead.

The old canvas should be deleted already, so if you stored a pointer to it, don't touch!

Note that currently there is a bug where in certain specific circumstances unsetCanvas can be called when it shouldn't, see for example KWStatisticsDocker for a workaround for this problem.

Implements KoCanvasObserverBase.

Definition at line 41 of file HistoryDock.cpp.

42{
43 setEnabled(false);
45}

References m_undoView, and KisUndoView::setStack().

Member Data Documentation

◆ m_undoView

KisUndoView* HistoryDock::m_undoView
private

Definition at line 35 of file HistoryDock.h.


The documentation for this class was generated from the following files: